Commit Graph

81 Commits

Author SHA1 Message Date
Linus Torvalds
850e82d889 diff-tree: don't match non-directories as partial pathnames
This normally doesn't matter, but if you have a filename that is
sometimes a directory and sometimes a regular file (or symlink),
we don't want the regular file case to trigger a "partial match".
2005-05-18 14:17:22 -07:00
Linus Torvalds
ed1a368ba1 diff-tree: fix "whole sub-tree disappeared or appeared" case
We still need to check which part of the sub-tree is interesting.
2005-05-18 14:07:42 -07:00
Linus Torvalds
cb6c8ed2fe diff-tree: fix up comparison of "interesting" sub-trees
We used to trigger the "interesting subdirectory" check for any
matching name that started with the same character series, regardless
of whether it had the matching slash or not.
2005-05-18 13:50:24 -07:00
Linus Torvalds
73848892ad diff-tree: show hex sha1 of the single-commit argument case correctly.
We can't just do the "sha1_to_hex()" thing directly, since the
buffer in question will be overwritten by the name of the parent.

So teach diff_tree_commit() to generate the proper hex name itself.
2005-05-18 13:43:58 -07:00
Linus Torvalds
0a8365a179 diff-tree: fix and extend argument parsing
We use "--" to mark end of command line switches, not "-". Also,
allow more flexibility in the passed-in sha1 names, in that a
single sha1 uses the "commit-diff" logic that compares against
its parent(s).
2005-05-18 13:10:17 -07:00
Linus Torvalds
b11645be01 diff-tree: clean up diff_tree_stdin() function
Split it into the "one commit" vs "two trees" case, since we'll
want to use the "one commit" case for other things too.
2005-05-18 13:06:47 -07:00
Linus Torvalds
a02ebff612 diff-tree: add author/date information to the verbose output 2005-05-06 15:33:59 -07:00
Junio C Hamano
5aad72f2bc [PATCH] Document --stdin, -m, -s, and -v flags to git-diff-tree
This updates the usage message string and Documentation/core-git.txt
to describe the new flags added to the git-diff-tree command.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-06 14:55:16 -07:00
Linus Torvalds
cee99d2257 diff-tree: add "verbose header" mode
This allows you to trivially do fancy and readable output. Something like

	git-rev-list HEAD | git-diff-tree -p -v --stdin kernel/ | less -S

gives a nice output of what has changed in the kernel/ subdirectory lately.
2005-05-06 11:42:47 -07:00
Linus Torvalds
f4f21ce367 git-diff-tree: clean up output
This only shows the tree headers when something actually changed. Also,
add a "silent" mode, which doesn't actually show the changes at all,
just the commit information.
2005-05-06 10:56:35 -07:00
Linus Torvalds
e0965d83c5 diff-tree: support list if input trees on stdin
This means that you can do

	git-rev-list HEAD --max-count=10 | git-diff-tree --stdin update-cache.c

to see which (if any) of the last ten commits changed update-cache.c.

Use the "-m" flag to see merges too. Normally they are suppressed.
2005-05-06 10:03:17 -07:00
Thomas Glanzmann
ed4eeaf203 [PATCH] git: Mention the '-p' option in the usage help string if git-diff-tree.
Mention the '-p' option in the usage help string of git-diff-tree.

Signed-Off-by: Thomas Glanzmann <sithglan@stud.uni-erlangen.de>
Signed-Off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-05 13:02:26 -07:00
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
3a663fd984 [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>
2005-04-27 16:25:59 -07:00
Junio C Hamano
3ebfd4aa29 [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>
2005-04-27 09:21:00 -07:00
Christopher Li
812666c8e6 [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>
2005-04-26 12:00:58 -07:00
Linus Torvalds
c5b423860d 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>
2005-04-23 22:08:00 -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
c1fdf2a6ab [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>
2005-04-20 18:06:50 -07:00
Linus Torvalds
abdb007d1f 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.
2005-04-19 21:39:28 -07:00
Linus Torvalds
6cbd72f8d5 Make "diff-tree" have similar behaviour as "ls-tree" wrt line termination.
Default to the human-readable '\n', but make the scriptable "-z" flag
do the old '\0' behaviour.
2005-04-15 15:11:57 -07:00
Petr Baudis
33b238d128 [PATCH] Change diff-tree output format
Changes diff-tree output format so that fields are separated by tabs instead of
spaces (readibility, parseability), and tree entry type is listed along the
entry (avoids having to figure that out from the mode in the scripts).

This is what my scripts expect.

Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-04-13 02:42:04 -07:00
Petr Baudis
35bb47855d [PATCH] diff-tree usage
Fix diff-tree usage, since it takes -r instead of -R now.

Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-04-13 02:39:33 -07:00
Ingo Molnar
aebb267908 [PATCH] Whitespace Fixes
Trivial whitespace fixes.

From: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-04-13 02:35:04 -07:00
Petr Baudis
2de381f919 [PATCH] Consolidate the error handling
Now there is error() for "library" errors and die() for fatal "application"
errors. usage() is now used strictly only for usage errors.

Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-04-13 02:28:48 -07:00
Linus Torvalds
bf16c71e2f Fix up commit-tree/diff-tree user interface issues.
No, this doesn't make them easy to use, but makes diff-tree use
the "-r" flag for "recursive" (not "-R") and makes commit-tree
use AUTHOR_xxx environment flags (not COMMITTER_xxx) to match what
it actually does.
2005-04-11 08:37:17 -07:00
Linus Torvalds
262e82b4a7 Fix diff-tree recursion.
And, perhaps more importantly, fix the fact that if a filename changed from a
directory to a file (or vice versa), we must consider it a delete and an add,
not a "filechange".
2005-04-10 21:49:26 -07:00
Linus Torvalds
eeb7991695 Simplify "diff-tree" output, and only keep track of one single name-base.
During original development I had different name-bases for source and
destination, so that I could make the output show how it got removed 
from "tree a" and added to "tree b", but we don't want that. We only
do recursive diffs on anything where the bases are exactly the same,
so we might as well just work with a single base.

Also, make the output for "changed" be a single line, since people
hated the separate '<' / '>' format. They were right. It sucked.
2005-04-10 15:08:02 -07:00
Linus Torvalds
73134b6d3f Add "-R" flag to "diff-tree", so that it will recursively traverse a tree of trees
as it diffs them.

This makes diff-tree usable again in the new world order.
2005-04-10 14:03:58 -07:00
Linus Torvalds
9174026cfe Add "diff-tree" program to show which files have changed between two trees.
Very useful for creating diffs efficiently, and in general to see what has
changed in the namespace.
2005-04-09 13:00:54 -07:00