git.git
19 years agodate handling: handle "AM"/"PM" on time
Linus Torvalds [Sun, 1 May 2005 19:34:56 +0000 (12:34 -0700)]
date handling: handle "AM"/"PM" on time

And be a bitmore careful about matching: if we don't recognize a word
or a number, we skip the whole thing, rather than trying the next character
in that word/number.

Finally: since ctime() adds the final '\n', don't add another one in test-date.

19 years agodate.c: allow even more varied time formats
Linus Torvalds [Sun, 1 May 2005 18:48:34 +0000 (11:48 -0700)]
date.c: allow even more varied time formats

(and some added checks for truly non-sensical stuff)

19 years ago[PATCH] Allow removing files in a subdirectory.
Junio C Hamano [Sun, 1 May 2005 16:33:12 +0000 (09:33 -0700)]
[PATCH] Allow removing files in a subdirectory.

I found this during a conflict merge testing.  The original did
not have either DF (a file) or DF/DF (a file DF/DF under a
directory DF).  One side created DF, the other created DF/DF.  I
first resolved DF as a new file by taking what the first side
did.  After that, the entry DF/DF cannot be resolved by running
git-update-cache --remove although it does not exist on the
filesystem.

    $ /bin/ls -F
    AN  DF  MN  NM  NN  SS  Z/
    $ git-ls-files --stage | grep DF
    100644 71420ab81e254145d26d6fc0cddee64c1acd4787 0 DF
    100644 68a6d8b91da11045cf4aa3a5ab9f2a781c701249 2 DF/DF
    $ git-update-cache --remove DF/DF
    fatal: Unable to add DF/DF to database

It turns out that the errno from open() in this case was not
ENOENT but ENOTDIR, which the code did not check.  Here is a
fix.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Really fix git-merge-one-file-script this time.
Junio C Hamano [Sun, 1 May 2005 16:33:12 +0000 (09:33 -0700)]
[PATCH] Really fix git-merge-one-file-script this time.

The merge-cache program was updated to pass executable bits when
calling git-merge-one-file-script, but the called script
supplied as an example were not using them carefully.

This patch fixes the following problems in the script:

 * When a new file is created in a directory, which is a file in
   the work tree, it tried to create leading directory but did
   not check for failure from the "mkdir -p" command.

 * The script did not check the exit status from the
   git-update-cache command at all.

 * The parameter "$4" to the script is a file name that can
   contain almost any characters, so it must be quoted with
   double quotes and also needs to be preceded with -- to mark
   it as a non-option when passed to certain commands.

 * The chmod command was used with parameter "$6" or "$7" to set
   the mode bits.  This contradicts with the strategy taken by
   checkout-cache, where we honor user's umask and force only
   the executable bits.  With this patch, it creates a new file
   by redirecting into it (thus honoring user's default umask),
   and then uses "chmod +x" if we want the resulting file
   executable.  Without this fix, the merge result becomes 0644
   or 0755 for users whose umask is 002 for whom it should
   become 0664 or 0775.

 * When "$1 -> $2 -> $3" case was not handled, the script did
   not say which path it was working on, which was not so useful
   when used with the -a option of git-merge-cache.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Add git-apply-patch-script.
Junio C Hamano [Sun, 1 May 2005 16:33:12 +0000 (09:33 -0700)]
[PATCH] Add git-apply-patch-script.

I said:

     - Stop attempting to be compatible with cg-patch, and drop
       (mode:XXXXXX) bits from the diff.

     - Do keep the /dev/null change for created and deleted case.

     - No "Index:" line, no "Mode change:" line, anywhere in the
       output.  Anything that wants the mode bits and sha1 hash can
       do things from GIT_EXTERNAL_DIFF mechanism.  Maybe document
       suggested usage better.

This adds an example script git-apply-patch-script, that can be
used as the GIT_EXTERNAL_DIFF to apply changes between two trees
directly on the current work tree, like this:

 GIT_EXTERNAL_DIFF=git-apply-patch-script git-diff-tree -p <tree> <tree>

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Rework built-in diff to make its output more dense.
Junio C Hamano [Sun, 1 May 2005 16:33:12 +0000 (09:33 -0700)]
[PATCH] Rework built-in diff to make its output more dense.

Linus says,

    The fewer lines there are that don't usually tell a human
    anything, the better. Dense is good.

This patch makes the default diff output more dense.  This
removes the previous misguided attempt to be cg-patch
compatible.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Resurrect diff-tree-helper -R
Junio C Hamano [Sun, 1 May 2005 00:59:35 +0000 (17:59 -0700)]
[PATCH] Resurrect diff-tree-helper -R

Diff-tree-helper take two patch inadvertently dropped the
support of -R option, which is necessary to produce reverse diff
based on diff-cache and diff-files output (diff-tree does not
matter since you can feed two trees in reverse order).  This
patch restores it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Split out "pull" from particular methods
Daniel Barkalow [Sat, 30 Apr 2005 23:53:56 +0000 (16:53 -0700)]
[PATCH] Split out "pull" from particular methods

The method for deciding what to pull is useful separately from any of the
ways of actually fetching the objects.

So split out "pull" functionality from http-pull and rpull

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agorev-tree.c: don't include unnecessary header files
Linus Torvalds [Sat, 30 Apr 2005 23:26:56 +0000 (16:26 -0700)]
rev-tree.c: don't include unnecessary header files

We used to have all these time-related issues, long gone now.

19 years agodate.c: fix printout of timezone offsets that aren't exact hours
Linus Torvalds [Sat, 30 Apr 2005 23:18:41 +0000 (16:18 -0700)]
date.c: fix printout of timezone offsets that aren't exact hours

We'd get the sign wrong for the minutes part of a negative offset.

19 years agodate.c: only use the TZ names if we don't have anything better.
Linus Torvalds [Sat, 30 Apr 2005 22:21:57 +0000 (15:21 -0700)]
date.c: only use the TZ names if we don't have anything better.

Also, add EEST (hey, it's Finland).

19 years agodate.c: split up dst information in the timezone table
Linus Torvalds [Sat, 30 Apr 2005 21:53:12 +0000 (14:53 -0700)]
date.c: split up dst information in the timezone table

This still doesn't actually really _use_ it properly, nor make any
distinction between different DST rules, but at least we could (if
we wanted to) fake it a bit better.

Right now the code actually still says "it's always summer". I'm
from Finland, I don't like winter.

19 years agodate.c: fix parsing of dates in mm/dd/yy format
Linus Torvalds [Sat, 30 Apr 2005 21:31:28 +0000 (14:31 -0700)]
date.c: fix parsing of dates in mm/dd/yy format

We looked at the year one character too early, and we
didn't accept a two-character year date after 2000.

19 years agodate.c: use the local timezone if none specified
Linus Torvalds [Sat, 30 Apr 2005 21:25:02 +0000 (14:25 -0700)]
date.c: use the local timezone if none specified

19 years ago[PATCH] fix usage string for renamed git commands
Nicolas Pitre [Sat, 30 Apr 2005 20:59:38 +0000 (13:59 -0700)]
[PATCH] fix usage string for renamed git commands

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoMake the date parsing accept pretty much any random crap.
Linus Torvalds [Sat, 30 Apr 2005 20:19:56 +0000 (13:19 -0700)]
Make the date parsing accept pretty much any random crap.

This date parser turns line-noise into a date. Cool.

19 years agoMake git-fsck-cache error printouts a bit more informative.
Linus Torvalds [Sat, 30 Apr 2005 18:22:26 +0000 (11:22 -0700)]
Make git-fsck-cache error printouts a bit more informative.

Show the types of objects involved in broken links, and don't bother
warning about unreachable tag files (if somebody cares about tags,
they'll use the --tags flag to see them).

19 years agoRename "show-files" to "ls-files"
Linus Torvalds [Sat, 30 Apr 2005 18:02:21 +0000 (11:02 -0700)]
Rename "show-files" to "ls-files"

As suggested by Nicolas Pitre

19 years agoFix up d_type handling - we need to include <dirent.h> before
Linus Torvalds [Sat, 30 Apr 2005 16:59:31 +0000 (09:59 -0700)]
Fix up d_type handling - we need to include <dirent.h> before
we play with the d_type compatibility macros.

19 years ago[PATCH] compat: replace AF_LOCAL with AF_UNIX
Edgar Toernig [Sat, 30 Apr 2005 16:51:03 +0000 (09:51 -0700)]
[PATCH] compat: replace AF_LOCAL with AF_UNIX

There's no AF_LOCAL in POSIX

19 years ago[PATCH] compat: missing dirent.d_type field
Edgar Toernig [Sat, 30 Apr 2005 16:51:03 +0000 (09:51 -0700)]
[PATCH] compat: missing dirent.d_type field

Not everybody has "d_type".

19 years ago[PATCH] compat: support pre-1.2 zlib
Edgar Toernig [Sat, 30 Apr 2005 16:51:03 +0000 (09:51 -0700)]
[PATCH] compat: support pre-1.2 zlib

Older zlib's don't have deflateBound()

19 years ago[PATCH] Do date parsing by hand...
Edgar Toernig [Sat, 30 Apr 2005 16:46:49 +0000 (09:46 -0700)]
[PATCH] Do date parsing by hand...

...since everything out there is either strange (libc mktime has issues
with timezones) or introduces unnecessary dependencies for people (libcurl).

This goes back to the old date parsing, but moves it out into a file of
its own, and does the "struct tm" to "seconds since epoch" handling by
hand.

I grepped through the tz-database and it seems there's one "country"
left that has non-60-minute DST: Lord Howe Island.  All others dropped
that before 1970.

19 years ago[PATCH] Fix AUTHOR_DATE timezone confusion
tony.luck@intel.com [Sat, 30 Apr 2005 03:27:04 +0000 (20:27 -0700)]
[PATCH] Fix AUTHOR_DATE timezone confusion

This switches git-commit-tree to using curl_getdate() for the
AUTHOR_DATE, and thus fixes the problem with "mktime()" parsing dates in
the local timezone.  It also ends up being more permissive about the
format of the date.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] git-fsck-cache: Gracefully handle non-commit IDs
Jonas Fonseca [Sat, 30 Apr 2005 03:00:40 +0000 (20:00 -0700)]
[PATCH] git-fsck-cache: Gracefully handle non-commit IDs

Gracefully handle non-commit IDs instead of segfaulting.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] GIT: Create tar archives of tree on the fly
Rene Scharfe [Sat, 30 Apr 2005 02:51:04 +0000 (19:51 -0700)]
[PATCH] GIT: Create tar archives of tree on the fly

Write commit ID to global extended pax header at the beginning of the tar
file, if possible.  get-tar-commit-id.c is an example program to get the
ID back out of such a tar archive.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] leftover bits for git rename
Junio C Hamano [Fri, 29 Apr 2005 23:25:05 +0000 (16:25 -0700)]
[PATCH] leftover bits for git rename

Linus said:

    "Let's see what else I forgot.."

Not that many, but here they are.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Makefile: The big git command renaming fallout fix.
Junio C Hamano [Fri, 29 Apr 2005 22:04:13 +0000 (15:04 -0700)]
[PATCH] Makefile: The big git command renaming fallout fix.

Here is another.  This one belongs to a clean-up category.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoUpdate the merge scripts for the big git rename.
Linus Torvalds [Fri, 29 Apr 2005 22:02:43 +0000 (15:02 -0700)]
Update the merge scripts for the big git rename.

Let's see what else I forgot..

19 years ago[PATCH] The big git command renaming fallout fix.
Junio C Hamano [Fri, 29 Apr 2005 21:54:50 +0000 (14:54 -0700)]
[PATCH] The big git command renaming fallout fix.

This fixes the git-export which calls diff-tree.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoRename git core commands to be "git-xxxx" to avoid name clashes.
Linus Torvalds [Fri, 29 Apr 2005 21:09:11 +0000 (14:09 -0700)]
Rename git core commands to be "git-xxxx" to avoid name clashes.

This also regularizes the make. The source files themselves don't get
the "git-" prefix, because that's just inconvenient. So instead we just
make the rule that "git-xxxx" depends on "xxxx.c", and do that for
all the core programs (ie the old "git-mktag.c" got renamed to just
"mktag.c" to match everything else).

And "show-diff" got renamed to "git-diff-files" while at it, since
that's what it really should be to match the other git-diff-xxx cases.

19 years ago[PATCH] GIT: Honour SHA1_FILE_DIRECTORY env var in git-pull-script
Rene Scharfe [Fri, 29 Apr 2005 19:08:03 +0000 (12:08 -0700)]
[PATCH] GIT: Honour SHA1_FILE_DIRECTORY env var in git-pull-script

If you set SHA1_FILE_DIRECTORY to something else than .git/objects
git-pull-script will store the fetched files in a location the rest of
the tools does not expect.

git-prune-script also ignores this setting, but I think this is good,
because pruning a shared tree to fit a single project means throwing
away a lot of useful data. :-)

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Use read_object_with_reference() in tar-tree
Rene Scharfe [Fri, 29 Apr 2005 05:19:02 +0000 (22:19 -0700)]
[PATCH] Use read_object_with_reference() in tar-tree

This patch replaces the usage of read_tree_with_tree_or_commit_sha1()
with read_object_with_reference() in tar-tree.  As a result the code
that tries to figure out the commit time doesn't need to open the commit
object 'by hand' any more.

Signed-off-by: Rene Scharfe <lsrfire.ath.cx>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Rename and extend read_tree_with_tree_or_commit_sha1
Junio C Hamano [Thu, 28 Apr 2005 23:42:27 +0000 (16:42 -0700)]
[PATCH] Rename and extend read_tree_with_tree_or_commit_sha1

This patch renames read_tree_with_tree_or_commit_sha1() to
read_object_with_reference() and extends it to automatically
dereference not just "commit" objects but "tag" objects.  With
this patch, you can say e.g.:

    ls-tree $tag
    read-tree -m $(merge-base $tag $HEAD) $tag $HEAD
    diff-cache $tag
    diff-tree $tag $HEAD

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] add short options to show-files
Nicolas Pitre [Thu, 28 Apr 2005 22:06:25 +0000 (15:06 -0700)]
[PATCH] add short options to show-files

The show-files long options are cumbersome to type.  This patch adds
equivalent short options.

Also add missing "unmerged" to usage string.

Finally reduce the number of lines for argument parsing in half.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] diff-tree does not need -r in git-export.c
Junio C Hamano [Thu, 28 Apr 2005 19:22:11 +0000 (12:22 -0700)]
[PATCH] diff-tree does not need -r in git-export.c

No need to pass -r anymore, since diff-tree -p implies recursive
behaviour these days.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] create tar archives of tree on the fly
Rene Scharfe [Thu, 28 Apr 2005 19:16:43 +0000 (12:16 -0700)]
[PATCH] create tar archives of tree on the fly

This is an improved version of tar-tree, a streaming archive creator for
GIT.  The major added feature is blocking; all write(2) calls now have a
size of 10240, just as GNU tar (and tape drives) likes them.  The
buffering overhead does not seem to degrade performance because most
files in the repositories I tested this with are smaller than 10KB, so
we need fewer system calls.

File names are still restricted to 500 bytes and the archive format
currently only allows for files up to 8GB.  Both restrictions can be
lifted if need be with more pax extended headers.

The archive format used is the pax interchange format, i.e.  POSIX tar
format.  It can be read by (and created with) GNU tar.  If I read the
specs correctly tar-tree should now be standards compliant (modulo
bugs).

Because it streams the archive (think ls-tree merged with cat-file),
tar-tree doesn't need to create any temporary files.  That makes it
quite fast.

It accepts tree IDs and commit IDs as first parameter.  In the latter
case tar-tree tries to get the commit date out of the committer line.
Else all files in the archive are time-stamped with the current time.

An optional second parameter is used as a path prefix for all files in
the archive.  Example:

   $ tar-tree a2755a80f40e5794ddc20e00f781af9d6320fafb \
   linux-2.6.12-rc3 | bzip9 -9 > linux-2.6.12-rc3.tar.bz2

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Give show-files the ability to process exclusion pattern.
Nicolas Pitre [Thu, 28 Apr 2005 18:44:04 +0000 (11:44 -0700)]
[PATCH] Give show-files the ability to process exclusion pattern.

This can be used with the famous dontdiff file as follows to find out
about uncommitted files just like dontdiff is used with the diff
command:

    show-files --others --exclude-from=dontdiff

and the exclude list can be reversed with the --ignore switch.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] diff-cache.c compilation warning fix.
Junio C Hamano [Thu, 28 Apr 2005 17:13:01 +0000 (10:13 -0700)]
[PATCH] diff-cache.c compilation warning fix.

Nobody uses return value from show_new_file() function but it is
defined as returning int and falls off at the end without
returning.  Make it void.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] diff.c: clean temporary files
Junio C Hamano [Thu, 28 Apr 2005 17:13:01 +0000 (10:13 -0700)]
[PATCH] diff.c: clean temporary files

When diff-cache -p and friends are interrupted, they can leave
their temporary files behind.  Also when the external diff
program is killed instead of exiting (this usually happens when
piping the output to a pager, which can cause SIGPIPE when the
user quits viewing the diff early), they incorrectly died
without cleaning their temporary file.

This fixes these problems.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] diff-tree-helper: do not report unmerged path outside specification.
Junio C Hamano [Thu, 28 Apr 2005 17:13:01 +0000 (10:13 -0700)]
[PATCH] diff-tree-helper: do not report unmerged path outside specification.

My bad.  diff-tree-helper reports all unmerged paths even when
the command line specifies to filter the paths.  This patch
fixes it.  Also reverse-diff option was left out during the last
round, which this patch restores as well.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Make diff-cache and friends output more cg-patch friendly.
Junio C Hamano [Thu, 28 Apr 2005 15:04:39 +0000 (08:04 -0700)]
[PATCH] Make diff-cache and friends output more cg-patch friendly.

This changes the way the default arguments to diff are built when
diff-cache and friends are invoked with -p and there is no
GIT_EXTERNAL_DIFF environment variable.  It attempts to be more cg-patch
friendly by:

 - Showing diffs against /dev/null to denote added or removed
   files;

 - Showing file modes for existing files as a comment after the
   diff label.

Unfortunately with this change GIT_DIFF_CMD customization cannot
be supported easily anymore, so it has been dropped.
GIT_DIFF_OPTS customization to change diffs from unified to
context is still there, though.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoFix up recent object model cleanups
Linus Torvalds [Thu, 28 Apr 2005 14:50:39 +0000 (07:50 -0700)]
Fix up recent object model cleanups

Make sure the Makefile knows about the object header dependencies, and
add declarations for tag lookup/parsing.

19 years ago[PATCH] Rework fsck-cache to use parse_object()
Daniel Barkalow [Thu, 28 Apr 2005 14:46:33 +0000 (07:46 -0700)]
[PATCH] Rework fsck-cache to use parse_object()

With support for parse_object() and tags in the core, fsck_cache can just
call them, and can be simplified a bit.

Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Add function to parse an object of unspecified type (take 2)
Daniel Barkalow [Thu, 28 Apr 2005 14:46:33 +0000 (07:46 -0700)]
[PATCH] Add function to parse an object of unspecified type (take 2)

This adds a function that parses an object from the database when we have
to look up its actual type. It also checks the hash of the file, due to
its heritage as part of fsck-cache.

Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Add tag header/parser to library
Daniel Barkalow [Thu, 28 Apr 2005 14:46:33 +0000 (07:46 -0700)]
[PATCH] Add tag header/parser to library

This adds preliminary support for tags in the library. It doesn't even
store the signature, however, let alone provide any way of checking it.

Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Mark blobs as parsed when they're actually parsed
Daniel Barkalow [Thu, 28 Apr 2005 14:46:33 +0000 (07:46 -0700)]
[PATCH] Mark blobs as parsed when they're actually parsed

This eliminates the special case for blobs versus other types of
objects. Now the scheme is entirely regular and I won't introduce stupid
bugs. (And fsck-cache doesn't have to do the do-nothing parse)

Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] diff-tree -p implies diff-tree -p -r
Junio C Hamano [Wed, 27 Apr 2005 23:25:59 +0000 (16:25 -0700)]
[PATCH] diff-tree -p implies diff-tree -p -r

This makes diff-tree -p imply recursive behaviour.

Other commands in the family always takes a flat universe view
so this is not even needed.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Use diff-tree -p -r instead of "git diff" in git-export.
Junio C Hamano [Wed, 27 Apr 2005 22:36:01 +0000 (15:36 -0700)]
[PATCH] Use diff-tree -p -r instead of "git diff" in git-export.

Now diff-tree can produce patch itself, there is no reason to
depend on Cogito to show diff in the git-export output anymore.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Make -s flag to show-diff a no-op.
Junio C Hamano [Wed, 27 Apr 2005 22:22:02 +0000 (15:22 -0700)]
[PATCH] Make -s flag to show-diff a no-op.

With the recent "no-patch-by-default" change, the -s flag to the
show-diff command (and silent variable in the show-diff.c) became
meaningless.  This deprecates it.

Cogito uses "show-diff -s" for the purpose of "I do not want the patch
text.  I just want to know if something has potentially changed, in
which case I know you will have some output.  I'll run update-cache
--refresh if you say something", so we cannot barf on seeing -s on our
command line yet.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Fix up <sys/socket.h> include dependency
Andreas Gal [Wed, 27 Apr 2005 20:46:36 +0000 (13:46 -0700)]
[PATCH] Fix up <sys/socket.h> include dependency

This makes rsh.c compile on Darwin/MacOSX (and might possibly help on
some Linux distributions too).

sys/socket.h needs sys/types.h

Signed-off-by: Andreas Gal <gal@uci.edu>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agodiff.c: don't add extra '/' to pathname
Linus Torvalds [Wed, 27 Apr 2005 17:21:13 +0000 (10:21 -0700)]
diff.c: don't add extra '/' to pathname

The "base" string already contains any finishing "/", so the way
to get the full pathname is to just concatenate the base and
path directly, with no extra slashes in between.

19 years agodiff-cache: handle modified new files correctly
Linus Torvalds [Wed, 27 Apr 2005 16:41:15 +0000 (09:41 -0700)]
diff-cache: handle modified new files correctly

Junio pointed out that diff-cache didn't handle the case of a new file
that was different from its index entry correctly. It needs to check
the working copy the same way the modified file case did.

19 years ago[PATCH] Teach diff-tree-helper to handle unmerged paths.
Junio C Hamano [Wed, 27 Apr 2005 16:21:00 +0000 (09:21 -0700)]
[PATCH] Teach diff-tree-helper to handle unmerged paths.

This teaches diff-tree-helper to call diff_unmerge() so that it can
report unmerged paths to GIT_EXTERNAL_DIFF, instead of consuming it on
its own.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Add -p (patch) to diff-cache.
Junio C Hamano [Wed, 27 Apr 2005 16:21:00 +0000 (09:21 -0700)]
[PATCH] Add -p (patch) to diff-cache.

This uses the reworked diff interface to generate patches directly out
of diff-cache when -p is specified.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Add -p (patch) to diff-tree.
Junio C Hamano [Wed, 27 Apr 2005 16:21:00 +0000 (09:21 -0700)]
[PATCH] Add -p (patch) to diff-tree.

This uses the reworked diff interface to generate patches directly out
of diff-tree when -p is specified.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Reactivate show-diff patch generation
Junio C Hamano [Wed, 27 Apr 2005 16:21:00 +0000 (09:21 -0700)]
[PATCH] Reactivate show-diff patch generation

This uses the reworked diff interface to generate patches directly out
of show-diff when -p is specified.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Reworked external diff interface.
Junio C Hamano [Wed, 27 Apr 2005 16:21:00 +0000 (09:21 -0700)]
[PATCH] Reworked external diff interface.

This introduces three public functions for diff-cache and friends can
use to call out to the GIT_EXTERNAL_DIFF program when they wish to.

A normal "add/remove/change" entry is turned into 7-parameter process
invocation of GIT_EXTERNAL_DIFF program as before.  In addition, the
program can now be called with a single parameter when diff-cache and
friends want to report an unmerged path.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoAllow writing to the private index file mapping.
Linus Torvalds [Wed, 27 Apr 2005 02:27:27 +0000 (19:27 -0700)]
Allow writing to the private index file mapping.

We now modify the in-memory copy of the index file in "diff-cache", so
we need to add PROT_WRITE.

19 years agodiff-cache: fix handling of unmerged files.
Linus Torvalds [Wed, 27 Apr 2005 01:03:07 +0000 (18:03 -0700)]
diff-cache: fix handling of unmerged files.

We've always warned about them properly, but we would then do the
wrong thing if that filename existed in the tree we were comparing
against (we'd think the file has been deleted, because we forgot
about the unmerged cases).

19 years agodiff-cache.c: use the "U <pathname>" format for unmerged entries.
Linus Torvalds [Wed, 27 Apr 2005 00:48:57 +0000 (17:48 -0700)]
diff-cache.c: use the "U <pathname>" format for unmerged entries.

This makes it match "show-diff" behaviour.

19 years ago[PATCH] diff-cache/tree compatible output for show-diff (take 2).
Junio C Hamano [Wed, 27 Apr 2005 00:39:01 +0000 (17:39 -0700)]
[PATCH] diff-cache/tree compatible output for show-diff (take 2).

This makes diff-tree-helper handle ("warn about") unmerged path entries

    U <path> <record-terminator>

This is emitted once per unmerged path, no matter how many unmerged
stages there are.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoshow-diff: don't print out the full "ce" format for unmerged files
Linus Torvalds [Wed, 27 Apr 2005 00:37:11 +0000 (17:37 -0700)]
show-diff: don't print out the full "ce" format for unmerged files

It really doesn't make sense, since there are potentially _many_ different
cache entries for an unmerged file. So just do the "U pathname" thing.

19 years agoshow-diff: match diff-tree and diff-cache output
Linus Torvalds [Wed, 27 Apr 2005 00:17:36 +0000 (17:17 -0700)]
show-diff: match diff-tree and diff-cache output

You'll need "diff-tree-helper" to show the full diff, but Junio is
dead set on adding a "-p" argument to all three to avoid it. That's
next..

19 years agogit-pull-script: do automatic merges
Linus Torvalds [Tue, 26 Apr 2005 19:26:46 +0000 (12:26 -0700)]
git-pull-script: do automatic merges

When the trivial "read-tree" merge fails, fall back on the (equally
trivial) automatic merge script instead of forcing the user to do
it by hand.

When _that_ fails, you get to do a manual merge.

19 years ago[PATCH] introduce xmalloc and xrealloc
Christopher Li [Tue, 26 Apr 2005 19:00:58 +0000 (12:00 -0700)]
[PATCH] introduce xmalloc and xrealloc

Introduce xmalloc and xrealloc to die gracefully with a descriptive
message when out of memory, rather than taking a SIGSEGV.

Signed-off-by: Christopher Li<chrislgit@chrisli.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoupdate-cache: remove index lock file on SIGINT
Linus Torvalds [Tue, 26 Apr 2005 18:55:42 +0000 (11:55 -0700)]
update-cache: remove index lock file on SIGINT

This makes it a lot more pleasant to use when you
interrupt a long-running operation.

19 years ago[PATCH] diff-cache buglet
Junio C Hamano [Tue, 26 Apr 2005 17:13:31 +0000 (10:13 -0700)]
[PATCH] diff-cache buglet

diff-cache attempts to first remove all merge entries before letting the
diff_cache() do its work, but it incorrectly stops after the first
merge-entry it finds.

Fix by just replacing the "break" with a "continue".

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Diff-tree-helper take two.
Junio C Hamano [Tue, 26 Apr 2005 16:25:05 +0000 (09:25 -0700)]
[PATCH] Diff-tree-helper take two.

This reworks the diff-tree-helper and show-diff to further make external
diff command interface simpler.

These commands now honor GIT_EXTERNAL_DIFF environment variable which
can point at an arbitrary program that takes 7 parameters:

  name file1 file1-sha1 file1-mode file2 file2-sha1 file2-mode

The parameters for an external diff command are as follows:

  name        this invocation of the command is to emit diff
      for the named cache/tree entry.

  file1       pathname that holds the contents of the first
      file.  This can be a file inside the working
      tree, or a temporary file created from the blob
      object, or /dev/null.  The command should not
      attempt to unlink it -- the temporary is
      unlinked by the caller.

  file1-sha1  sha1 hash if file1 is a blob object, or "."
      otherwise.

  file1-mode  mode bits for file1, or "." for a deleted file.

If GIT_EXTERNAL_DIFF environment variable is not set, the
default is to invoke diff with the set of parameters old
show-diff used to use.  This built-in implementation honors the
GIT_DIFF_CMD and GIT_DIFF_OPTS environment variables as before.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Introduce diff-tree-helper.
Junio C Hamano [Tue, 26 Apr 2005 01:26:45 +0000 (18:26 -0700)]
[PATCH] Introduce diff-tree-helper.

This patch introduces a new program, diff-tree-helper.  It reads
output from diff-cache and diff-tree, and produces a patch file.
The diff format customization can be done the same way the
show-diff uses; the same external diff interface introduced by
the previous patch to drive diff from show-diff is used so this
is not surprising.

It is used like the following examples:

   $ diff-cache --cached -z <tree> | diff-tree-helper -z -R paths...
   $ diff-tree -r -z <tree1> <tree2> | diff-tree-helper -z paths...

 - As usual, the use of the -z flag is recommended in the script
   to pass NUL-terminated filenames through the pipe between
   commands.

 - The -R flag is used to generate reverse diff.  It does not
   matter for diff-tree case, but it is sometimes useful to get
   a patch in the desired direction out of diff-cache.

 - The paths parameters are used to restrict the paths that
   appears in the output.  Again this is useful to use with
   diff-cache, which, unlike diff-tree, does not take such paths
   restriction parameters.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Split external diff command interface to a separate file.
Junio C Hamano [Tue, 26 Apr 2005 01:22:47 +0000 (18:22 -0700)]
[PATCH] Split external diff command interface to a separate file.

With this patch, the non-core'ish part of show-diff command that
invokes an external "diff" comand to obtain patches is split
into a separate file.  The next patch will introduce a new
command, diff-tree-helper, which uses this common diff interface
to format diff-tree and diff-cache output into a patch form.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agofsck-cache: show root objects only with "--root"
Linus Torvalds [Mon, 25 Apr 2005 23:34:13 +0000 (16:34 -0700)]
fsck-cache: show root objects only with "--root"

This makes the default fsck behaviour be quiet for a repository
that doesn't have any problems. Which is good.

19 years agofsck-cache: only show tags if asked to do so with "--tags"
Linus Torvalds [Mon, 25 Apr 2005 23:31:13 +0000 (16:31 -0700)]
fsck-cache: only show tags if asked to do so with "--tags"

Normally we don't care, we just check them for being valid tag
objects.

19 years agoAdd the git-*-script files to the install
Linus Torvalds [Mon, 25 Apr 2005 22:29:45 +0000 (15:29 -0700)]
Add the git-*-script files to the install

19 years agoAdd example "git-tag-script" to show how to create signed tag objects.
Linus Torvalds [Mon, 25 Apr 2005 22:23:53 +0000 (15:23 -0700)]
Add example "git-tag-script" to show how to create signed tag objects.

19 years agoMake "fsck" also show what the name of the tag object is, not just
Linus Torvalds [Mon, 25 Apr 2005 22:21:49 +0000 (15:21 -0700)]
Make "fsck" also show what the name of the tag object is, not just
the name of the object it tags.

You need this if you actually want to build up a list of tags.

19 years agoAdd "tag" objects that can be used to sign other objects.
Linus Torvalds [Mon, 25 Apr 2005 19:07:44 +0000 (12:07 -0700)]
Add "tag" objects that can be used to sign other objects.

You use "git-mktag" to create them, and fsck-cache knows how to parse them.

19 years agoFix up the types in write_sha1_file
Linus Torvalds [Mon, 25 Apr 2005 19:04:55 +0000 (12:04 -0700)]
Fix up the types in write_sha1_file

Use "unsigned long" for the size, like we do everywhere else.

19 years agoSimplify "write_sha1_file()" interfaces
Linus Torvalds [Mon, 25 Apr 2005 17:19:53 +0000 (10:19 -0700)]
Simplify "write_sha1_file()" interfaces

The write function now adds the header to the file by itself, so there
is no reason to duplicate it among all the users any more.

19 years agofsck-cache: warn about missing commit dates
Linus Torvalds [Sun, 24 Apr 2005 23:20:53 +0000 (16:20 -0700)]
fsck-cache: warn about missing commit dates

Now that we have hopefully converted all old archives, we
can consider it an error.

19 years agoUpdate "convert-cache" to handle git itself.
Linus Torvalds [Sun, 24 Apr 2005 22:49:09 +0000 (15:49 -0700)]
Update "convert-cache" to handle git itself.

The git archives have some old-date-format commits with timezones
that the converter didn't recognize. Also, make it be quiet about
already-converted dates.

19 years ago[PATCH] update-cache: add "--ignore-missing" option
James Bottomley [Sun, 24 Apr 2005 22:14:16 +0000 (15:14 -0700)]
[PATCH] update-cache: add "--ignore-missing" option

This adds an --ignore-missing option to update-cache, which makes it
ignore missing files.  Together with the "-n" option to checkout-cache,
it allows me to do

    checkout-cache -n -f -a && update-cache --ignore-missing --refresh

which only updates and refreshes the files I already have checked out.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] checkout-cache: add "-n" option
James Bottomley [Sun, 24 Apr 2005 22:14:16 +0000 (15:14 -0700)]
[PATCH] checkout-cache: add "-n" option

This adds the "-n" option to checkout-cache which tells it to not check
out new files, only refresh files already checked out.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoDon't add references to objects we couldn't find.
Linus Torvalds [Sun, 24 Apr 2005 21:31:57 +0000 (14:31 -0700)]
Don't add references to objects we couldn't find.

That would SIGSEGV.

19 years agoVerify that the object type matches for tree/commit objects even before parsing.
Linus Torvalds [Sun, 24 Apr 2005 21:22:09 +0000 (14:22 -0700)]
Verify that the object type matches for tree/commit objects even before parsing.

The type doesn't come from the parsing, the type also has to match the usage.

19 years agoSet object type at object creation time, not object parse time.
Linus Torvalds [Sun, 24 Apr 2005 21:17:13 +0000 (14:17 -0700)]
Set object type at object creation time, not object parse time.

Otherwise we can have objects without a type, which is not good.

19 years agofsck-cache: notice missing "blob" objects.
Linus Torvalds [Sun, 24 Apr 2005 21:10:55 +0000 (14:10 -0700)]
fsck-cache: notice missing "blob" objects.

We should _not_ mark a blob object "parsed" just because we
looked it up: it gets marked that way only once we've actually
seen it. Otherwise we can never notice a missing blob.

19 years ago[PATCH] fix segfault in fsck-cache
Andreas Gal [Sun, 24 Apr 2005 21:04:13 +0000 (14:04 -0700)]
[PATCH] fix segfault in fsck-cache

Here is how to trigger it:

   echo blob 100 > .git/objects/00/ae4e8d3208e09f2cf7a38202a126f728cadb49

Then run fsck-cache. It will try to unpack after the header to calculate
the hash, inflate returns total_out == 0 and memcpy() dies.

The patch below seems to work with ZLIB 1.1 and 1.2.

Signed-off-by: Andreas Gal <gal@uci.edu>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoSupport a fine-grained diff-tree
Linus Torvalds [Sun, 24 Apr 2005 05:08:00 +0000 (22:08 -0700)]
Support a fine-grained diff-tree

This is based on a patch by David Woodhouse, but with the selection
tests much simplified and streamlined.

It makes diff-tree take extra arguments, specifying the files or
directories which should be considered "interesting". Changes in
uninteresting directories are not reported.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] make file merging respect permissions
James Bottomley [Sun, 24 Apr 2005 03:50:10 +0000 (20:50 -0700)]
[PATCH] make file merging respect permissions

1) permissions aren't respected in the merge script (primarily because
they're never passed in to it in the first place).  Fix that and also
check for permission conflicts in the merge

2) the delete of a file in both branches may indeed be just that, but it
could also be the indicator of a rename conflict (file moved to
different locations in both branches), so error out and ask the
committer for guidance.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Allow multiple date-ordered lists
Daniel Barkalow [Sun, 24 Apr 2005 03:29:22 +0000 (20:29 -0700)]
[PATCH] Allow multiple date-ordered lists

Make pop_most_recent_commit() return the same objects multiple times, but only
if called with different bits to mark.

This is necessary to make merge-base work again.

Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoDon't add parents to the commit list if we have already
Linus Torvalds [Sun, 24 Apr 2005 02:21:28 +0000 (19:21 -0700)]
Don't add parents to the commit list if we have already
seen them.

Otherwise any merges will make the parent list explode.

19 years agoAdd "rev-list" program that uses the new time-based commit listing.
Linus Torvalds [Sun, 24 Apr 2005 02:04:40 +0000 (19:04 -0700)]
Add "rev-list" program that uses the new time-based commit listing.

This is probably what you'd want to see for "git log".

19 years ago[PATCH] Various transport programs
Daniel Barkalow [Sun, 24 Apr 2005 01:47:23 +0000 (18:47 -0700)]
[PATCH] Various transport programs

This patch adds three similar and related programs. http-pull downloads
objects from an HTTP server; rpull downloads objects by using ssh and
rpush on the other side; and rpush uploads objects by using ssh and rpull
on the other side.

The algorithm should be sufficient to make the network throughput required
depend only on how much content is new, not at all on how much content the
repository contains.

The combination should enable people to have remote repositories by way of
ssh login for authenticated users and HTTP for anonymous access.

Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Replace merge-base implementation
Daniel Barkalow [Sun, 24 Apr 2005 01:47:23 +0000 (18:47 -0700)]
[PATCH] Replace merge-base implementation

The old implementation was a nice algorithm, but, unfortunately, it could
be confused in some cases and would not necessarily do the obvious thing
if one argument was decended from the other. This version fixes that by
changing the criterion to the most recent common ancestor.

Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Additional functions for the objects database
Daniel Barkalow [Sun, 24 Apr 2005 01:47:23 +0000 (18:47 -0700)]
[PATCH] Additional functions for the objects database

This adds two functions: one to check if an object is present in the local
database, and one to add an object to the local database by reading it
from a file descriptor and checking its hash.

Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Parse tree objects completely
Daniel Barkalow [Sun, 24 Apr 2005 01:47:23 +0000 (18:47 -0700)]
[PATCH] Parse tree objects completely

This adds the contents of trees to struct tree.

Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Add some functions for commit lists
Daniel Barkalow [Sun, 24 Apr 2005 01:47:23 +0000 (18:47 -0700)]
[PATCH] Add some functions for commit lists

This adds a function for inserting an item in a commit list, a function
for sorting a commit list by date, and a function for progressively
scanning a commit history from most recent to least recent.

Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Simplify building of programs
Jonas Fonseca [Sun, 24 Apr 2005 01:41:48 +0000 (18:41 -0700)]
[PATCH] Simplify building of programs

Do not first build .o files when building programs.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Fix broken diff-cache output on added files
Petr Baudis [Sun, 24 Apr 2005 01:05:07 +0000 (18:05 -0700)]
[PATCH] Fix broken diff-cache output on added files

Added files were errorneously reported with the - prefix by diff-cache,
obviously leading to great confusion.

Signed-off-by: Petr Baudis <pasky@ucw.cz>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>