git.git
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>
19 years agoMake a hack to convert-cache for missing author dates in old
Linus Torvalds [Sat, 23 Apr 2005 23:48:32 +0000 (16:48 -0700)]
Make a hack to convert-cache for missing author dates in old
archives (notably the old sparse one).

Very hacky. But hopefully we can do the conversion once, and never
worry about this ever again.

19 years agoMake "convert-cache" able to handle the really old archive formats
Linus Torvalds [Sat, 23 Apr 2005 23:37:31 +0000 (16:37 -0700)]
Make "convert-cache" able to handle the really old archive formats

This includes the old-style "flat tree" object, and the old broken
date format. Well, enough of the date format to convert the sparse
archive, at least.

19 years agoUse O_NOATIME when opening the sha1 files.
Linus Torvalds [Sat, 23 Apr 2005 18:09:32 +0000 (11:09 -0700)]
Use O_NOATIME when opening the sha1 files.

We really don't care about atime, and it sucks to dirty the
inode cache just for it.

This is more than a one-liner only because we need to be able to
clear the O_NOATIME flag in case some of the objects are owned
by others (in which case open will return EPERM), and because not
everybody has the O_NOATIME flag.

19 years ago[PATCH] PPC assembly implementation of SHA1
Paul Mackerras [Sat, 23 Apr 2005 06:08:43 +0000 (23:08 -0700)]
[PATCH] PPC assembly implementation of SHA1

Here is a SHA1 implementation with the core written in PPC assembly.
On my 2GHz G5, it does 218MB/s, compared to 135MB/s for the openssl
version or 45MB/s for the mozilla version.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoNew "diff-cache" implementation.
Linus Torvalds [Sat, 23 Apr 2005 00:15:28 +0000 (17:15 -0700)]
New "diff-cache" implementation.

This one is about a million times simpler, and much more likely to be
correct too.

Instead of trying to match up a tree object against the index, we just
read in the tree object side-by-side into the index, and just walk the
resulting index file. This was what all the read-tree cleanups were
all getting to.

19 years agoMove "read_tree()" to "tree.c" to be used as a generic helper function.
Linus Torvalds [Fri, 22 Apr 2005 23:42:37 +0000 (16:42 -0700)]
Move "read_tree()" to "tree.c" to be used as a generic helper function.

Next step: make "diff-cache" use it.

19 years agoClean up and simplify read-tree a bit.
Linus Torvalds [Fri, 22 Apr 2005 23:35:06 +0000 (16:35 -0700)]
Clean up and simplify read-tree a bit.

This is preparation for moving parts of it into "tree.c" to be used
as a library function.

19 years agoAdd support for alternate SHA1 library implementations.
Linus Torvalds [Thu, 21 Apr 2005 19:33:22 +0000 (12:33 -0700)]
Add support for alternate SHA1 library implementations.

This one includes the Mozilla SHA1 implementation sent in by Edgar Toernig.
It's dual-licenced under MPL-1.1 or GPL, so in the context of git, we
obviously use the GPL version.

Side note: the Mozilla SHA1 implementation is about twice as fast as the
default openssl one on my G5, but the default openssl one has optimized
x86 assembly language on x86. So choose wisely.

19 years agoSplit up Makefile library list handling with separate entries for
Linus Torvalds [Thu, 21 Apr 2005 19:14:46 +0000 (12:14 -0700)]
Split up Makefile library list handling with separate entries for
zlib and libssl.

I'll start giving people choices here..

19 years agoInclude <limits.h> in commit.c for ULONG_MAX. Remove old "revision.h".
Linus Torvalds [Thu, 21 Apr 2005 18:21:33 +0000 (11:21 -0700)]
Include <limits.h> in commit.c for ULONG_MAX. Remove old "revision.h".

The old revision.h helper header isn't used any more, but I never noticed
it until I started grepping for ULONG_MAX users.

19 years agoAdd support for a "GIT_INDEX_FILE" environment variable.
Linus Torvalds [Thu, 21 Apr 2005 17:55:18 +0000 (10:55 -0700)]
Add support for a "GIT_INDEX_FILE" environment variable.

We use that to specify alternative index files, which can be useful
if you want to (for example) generate a temporary index file to do
some specific operation that you don't want to mess with your main
one with.

It defaults to the regular ".git/index" if it hasn't been specified.

19 years agoAdd the ability to prefix something to the pathname to "checkout-cache.c"
Linus Torvalds [Thu, 21 Apr 2005 17:15:02 +0000 (10:15 -0700)]
Add the ability to prefix something to the pathname to "checkout-cache.c"

This basically makes it trivial to use checkout-cache as a "export as
tree" function. Just read the desired tree into the index, and do a

checkout-cache --prefix=export-dir/ -a

and checkout-cache will "export" the cache into the specified directory.

NOTE! The final "/" is important. The exported name is literally just
prefixed with the specified string, so you can also do something like

checkout-cache --prefix=.merged- Makefile

to check out the currently cached copy of "Makefile" into the file
".merged-Makefile".

19 years agoFix NSEC compile problem, and properly parse the rev-tree cmd line.
Linus Torvalds [Thu, 21 Apr 2005 16:58:24 +0000 (09:58 -0700)]
Fix NSEC compile problem, and properly parse the rev-tree cmd line.

The rev-tree thing just happened to work. It shouldn't have.

19 years ago[PATCH] Usage-string fixes.
Junio C Hamano [Thu, 21 Apr 2005 02:49:16 +0000 (19:49 -0700)]
[PATCH] Usage-string fixes.

Usage string fixes to make maintenance easier (only one instance
of a string to update not multiple copies).  I've spotted and
corrected inconsistent usage text in diff-tree while doing this.

Also diff-cache and read-tree usage text have been corrected to
match their up-to-date features.  Earlier, neither "--cached"
form of diff-cache nor "-m single-merge" form of read-tree were
described.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoDuh, just make git-export.c use the proper syntax, everything is fine.
Linus Torvalds [Thu, 21 Apr 2005 02:19:11 +0000 (19:19 -0700)]
Duh, just make git-export.c use the proper syntax, everything is fine.

19 years agoFix up some problems from the commit->tree helper patch
Linus Torvalds [Thu, 21 Apr 2005 01:49:41 +0000 (18:49 -0700)]
Fix up some problems from the commit->tree helper patch

19 years agoFix up git-export to use the lower-level interfaces for diff generation.
Linus Torvalds [Thu, 21 Apr 2005 01:48:27 +0000 (18:48 -0700)]
Fix up git-export to use the lower-level interfaces for diff generation.

The high-level helpers seem to have forgotten what to do with sha1
names.

19 years ago[PATCH] Teach read-tree about commit objects
Junio C Hamano [Thu, 21 Apr 2005 01:06:50 +0000 (18:06 -0700)]
[PATCH] Teach read-tree about commit objects

Updates read-tree to use read_tree_with_tree_or_commit_sha1()
function.  The command can take either tree or commit IDs with
this patch.

The change involves a slight modification of how it recurses down
the tree.  Earlier the caller only supplied SHA1 and the recurser
read the object using it, but now it is the caller's responsibility
to read the object and give it to the recurser.  This matches the
way recursive behaviour is done in other tree- related commands.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Teach ls-tree about commit objects
Junio C Hamano [Thu, 21 Apr 2005 01:06:50 +0000 (18:06 -0700)]
[PATCH] Teach ls-tree about commit objects

Updates ls-tree.c to use read_tree_with_tree_or_commit_sha1()
function.  The command can take either tree or commit IDs with
this patch.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Teach diff-tree about commit objects
Junio C Hamano [Thu, 21 Apr 2005 01:06:50 +0000 (18:06 -0700)]
[PATCH] Teach diff-tree about commit objects

Updates diff-tree.c to use read_tree_with_tree_or_commit_sha1()
function.  The command can take either tree or commit IDs with this patch.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Teach diff-cache about commit objects
Junio C Hamano [Thu, 21 Apr 2005 01:06:49 +0000 (18:06 -0700)]
[PATCH] Teach diff-cache about commit objects

Updates diff-cache.c to use read_tree_with_tree_or_commit_sha1()
function.  The end-user visible result is the same --- the command
takes either tree or commit ID.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Accept commit in some places when tree is needed.
Junio C Hamano [Thu, 21 Apr 2005 01:06:49 +0000 (18:06 -0700)]
[PATCH] Accept commit in some places when tree is needed.

This patch implements read_tree_with_tree_or_commit_sha1(),
which can be used when you are interested in reading an unpacked
raw tree data but you do not know nor care if the SHA1 you
obtained your user is a tree ID or a commit ID.  Before this
function's introduction, you would have called read_sha1_file(),
examined its type, parsed it to call read_sha1_file() again if
it is a commit, and verified that the resulting object is a
tree.  Instead, this function does that for you.  It returns
NULL if the given SHA1 is not either a tree or a commit.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] simplify Makefile
Andre Noll [Wed, 20 Apr 2005 20:10:13 +0000 (13:10 -0700)]
[PATCH] simplify Makefile

Use a generic rule for executables that depend only on the corresponding
.o and on $(LIB_FILE).

Signed-Off-By: Andre Noll <maan@systemlinux.org>
Signed-Off-By: Linus Torvalds <torvalds@osdl.org>
19 years agoImprove build: add <unistd.h> and use -O2 instead of -O3
Linus Torvalds [Wed, 20 Apr 2005 20:00:08 +0000 (13:00 -0700)]
Improve build: add <unistd.h> and use -O2 instead of -O3

(Nobody should use -O3. It just makes bad inlining decisions).

19 years agoMake the sha1 of the index file go at the very end of the file.
Linus Torvalds [Wed, 20 Apr 2005 19:36:41 +0000 (12:36 -0700)]
Make the sha1 of the index file go at the very end of the file.

This allows us to both calculate it and verify it faster.

19 years agoSpeed up index file writing by chunking it nicely.
Linus Torvalds [Wed, 20 Apr 2005 19:16:57 +0000 (12:16 -0700)]
Speed up index file writing by chunking it nicely.

No point in making 17,000 small writes when you can make just
a couple of hundred nice 8kB writes instead and save a lot
of time.

19 years agoMake "write_sha1_file()" exit early if the file already exists.
Linus Torvalds [Wed, 20 Apr 2005 16:28:05 +0000 (09:28 -0700)]
Make "write_sha1_file()" exit early if the file already exists.

Avoid the compression.

19 years agoThe recent hash/compression switch-over missed the blob creation.
Linus Torvalds [Wed, 20 Apr 2005 08:34:54 +0000 (01:34 -0700)]
The recent hash/compression switch-over missed the blob creation.

Happily, convert-cache just magically fixes all errors.

19 years agoDo SHA1 hash _before_ compression.
Linus Torvalds [Wed, 20 Apr 2005 08:10:46 +0000 (01:10 -0700)]
Do SHA1 hash _before_ compression.

And add a "convert-cache" program to convert from old-style
to new-style.

19 years ago[PATCH] init-db.c: create and use safe_create_dir helper
Zach Welch [Wed, 20 Apr 2005 04:48:15 +0000 (21:48 -0700)]
[PATCH] init-db.c: create and use safe_create_dir helper

Factor mkdir calls into common safe_create_dir subroutine.

Signed-Off-By: Zach Welch <zw@superlucidity.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] init-db.c: normalize env var handling.
Zach Welch [Wed, 20 Apr 2005 04:48:15 +0000 (21:48 -0700)]
[PATCH] init-db.c: normalize env var handling.

Normalize init-db environment variable handling, allowing the creation
of object directories with something other than DEFAULT_DB_ENVIRONMENT.

Signed-Off-By: Zach Welch <zw@superlucidity.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] init-db.c: cleanup comments
Zach Welch [Wed, 20 Apr 2005 04:48:15 +0000 (21:48 -0700)]
[PATCH] init-db.c: cleanup comments

Consolidate comments at top of main.

Signed-Off-By: Zach Welch <zw@superlucidity.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoMake "diff-tree" take commit objects too, like "diff-cache" does.
Linus Torvalds [Wed, 20 Apr 2005 04:39:28 +0000 (21:39 -0700)]
Make "diff-tree" take commit objects too, like "diff-cache" does.

Sometimes it's just easier to not have to look up the "commit"->"tree"
translation by hand first. It's trivial to do inside diff-tree, and
it's just being polite.

19 years agoAdd "diff-cache" helper program to compare a tree (or commit) with
Linus Torvalds [Wed, 20 Apr 2005 04:00:09 +0000 (21:00 -0700)]
Add "diff-cache" helper program to compare a tree (or commit) with
the current cache state and/or working directory.

Very useful to see what has changed since the last commit, either in
the index file or in the whole working directory.

Also very possibly very buggy. Matching the two up is not entirely
trivial.

19 years agoMake us be better at guessing a good hostname for the email.
Linus Torvalds [Tue, 19 Apr 2005 22:46:06 +0000 (15:46 -0700)]
Make us be better at guessing a good hostname for the email.

It's still just a guess, and the result is not a real email
address anyway. If you want to, you can use COMMIT_AUTHOR_EMAIL
to correct for any git guesses.

19 years agoRemove duplicate getenv(DB_ENVIRONMENT) call
Linus Torvalds [Tue, 19 Apr 2005 21:11:06 +0000 (14:11 -0700)]
Remove duplicate getenv(DB_ENVIRONMENT) call

Noted by Tony Luck.

19 years agoAdd stupid "git export" thing, which can export a git archive
Linus Torvalds [Tue, 19 Apr 2005 21:00:34 +0000 (14:00 -0700)]
Add stupid "git export" thing, which can export a git archive
as a set of patches and commentary.

You'd want something like this if you are tracking a git archive
in another SCM format. Notably, we want something like that for
BK users.

19 years agoFix init-db shared database case
Linus Torvalds [Tue, 19 Apr 2005 20:59:17 +0000 (13:59 -0700)]
Fix init-db shared database case

Noted by Aaron Straus

19 years agoUpdate "git-pull-script" to use "read-tree -m" for
Linus Torvalds [Tue, 19 Apr 2005 19:56:47 +0000 (12:56 -0700)]
Update "git-pull-script" to use "read-tree -m" for
reading a single tree too. That should speed up a
trivial merge noticeably.

Also, don't bother reading back the tree we just wrote
when we committed a real merge. It had better be the
same one we still have..

19 years agoMake "read-tree" know how to do a "1-way merge".
Linus Torvalds [Tue, 19 Apr 2005 18:41:18 +0000 (11:41 -0700)]
Make "read-tree" know how to do a "1-way merge".

This one just reads one tree, but picks up any matching stat information
from the old index.