Commit graph

13 commits

Author SHA1 Message Date
Linus Torvalds 3c249c9506 Add "get_sha1()" helper function.
This allows the programs to use various simplified versions of
the SHA1 names, eg just say "HEAD" for the SHA1 pointed to by
the .git/HEAD file etc.

For example, this commit has been done with

	git-commit-tree $(git-write-tree) -p HEAD

instead of the traditional "$(cat .git/HEAD)" syntax.
2005-05-01 16:36:56 -07:00
Junio C Hamano 40469ee9c6 [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>
2005-04-28 16:42:27 -07:00
Junio C Hamano b836825b55 [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>
2005-04-28 10:13:01 -07:00
Linus Torvalds c9cddabe99 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.
2005-04-27 09:41:15 -07:00
Junio C Hamano f92a446581 [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>
2005-04-27 09:21:00 -07:00
Linus Torvalds b0fe89caeb 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).
2005-04-26 18:03:07 -07:00
Linus Torvalds a5cd7e1620 diff-cache.c: use the "U <pathname>" format for unmerged entries.
This makes it match "show-diff" behaviour.
2005-04-26 17:48:57 -07:00
Junio C Hamano 5697ecc7be [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>
2005-04-26 10:13:31 -07:00
Petr Baudis 65bc81d6fe [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>
2005-04-23 18:05:07 -07:00
Linus Torvalds b5af910727 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.
2005-04-22 17:15:28 -07:00
Junio C Hamano c5bac17ad2 [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>
2005-04-20 19:49:16 -07:00
Junio C Hamano 38357e6703 [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>
2005-04-20 18:06:49 -07:00
Linus Torvalds e74f8f6aa7 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.
2005-04-19 21:00:09 -07:00