summaryrefslogtreecommitdiff
path: root/diff-tree.c
AgeCommit message (Collapse)Author
2005-05-22[PATCH] The diff-raw format updates.Junio C Hamano
Update the diff-raw format as Linus and I discussed, except that it does not use sequence of underscore '_' letters to express nonexistence. All '0' mode is used for that purpose instead. The new diff-raw format can express rename/copy, and the earlier restriction that -M and -C _must_ be used with the patch format output is no longer necessary. The patch makes -M and -C flags independent of -p flag, so you need to say git-whatchanged -M -p to get the diff/patch format. Updated are both documentations and tests. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-22[PATCH] Prepare diffcore interface for diff-tree header supression.Junio C Hamano
This does not actually supress the extra headers when pickaxe is used, but prepares enough support for diff-tree to implement it. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-21diff-tree: don't print multiple headers for merges when silent.Linus Torvalds
Normally we show every facet of a merge, but when we're silent, there's little point.
2005-05-21[PATCH] Constness fix for pickaxe option.Junio C Hamano
Constness fix for pickaxe option. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-21diff-tree: prettify output slightlyLinus Torvalds
Make the commit explanation buffer larger, and make sure that if we truncate it, we put a "..." marker there to visually tell people about the truncation (tested with a much smaller buffer to make sure it looks sane). Also make sure that the explanation is properly line-terminated, and add an extra newline iff we have a diff.
2005-05-21[PATCH] Introducing software archaeologist's tool "pickaxe".Junio C Hamano
This steals the "pickaxe" feature from JIT and make it available to the bare Plumbing layer. From the command line, the user gives a string he is intersted in. Using the diff-core infrastructure previously introduced, it filters the differences to limit the output only to the diffs between <src> and <dst> where the string appears only in one but not in the other. For example: $ ./git-rev-list HEAD | ./git-diff-tree -Sdiff-tree-helper --stdin -M would show the diffs that touch the string "diff-tree-helper". In real software-archaeologist application, you would typically look for a few to several lines of code and see where that code came from. The "pickaxe" module runs after "rename/copy detection" module, so it even crosses the file rename boundary, as the above example demonstrates. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-21[PATCH] Diff overhaul, adding half of copy detection.Junio C Hamano
This introduces the diff-core, the layer between the diff-tree family and the external diff interface engine. The calls to the interface diff-tree family uses (diff_change and diff_addremove) have not changed and will not change. The purpose of the diff-core layer is to provide an infrastructure to transform the set of differences sent from the applications, before sending them to the external diff interface. The recently introduced rename detection code has been rewritten to use the diff-core facility. When applications send in separate creates and deletes, matching ones are transformed into a single rename-and-edit diff, and sent out to the external diff interface as such. This patch also enhances the rename detection code further to be able to detect copies. Currently this happens only as long as copy sources appear as part of the modified files, but there already is enough provision for callers to report unmodified files to diff-core, so that they can be also used as copy source candidates. Extending the callers this way will be done in a separate patch. Please see and marvel at how well this works by trying out the newly added t/t4003-diff-rename-1.sh test script. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-20sparse cleanupLinus Torvalds
Fix various things that sparse complains about: - use NULL instead of 0 - make sure we declare everything properly, or mark it static - use proper function declarations ("fn(void)" instead of "fn()") Sparse is always right.
2005-05-20diff-tree: use new base_name_compare() helper functionLinus Torvalds
This fixes diff-tree sorting of directories vs files (we used to use just the regular cache_name_compare() which only works on full file pathnames).
2005-05-20Fix up previous commitLinus Torvalds
Add '-R' flag to diff-tree, and change the test subdirectory shell files to be executable (something that Junio couldn't get me to do through the pure patch with my current patch handling infrastructure).
2005-05-20[PATCH] diff overhaulJunio C Hamano
This cleans up the way calls are made into the diff core from diff-tree family and diff-helper. Earlier, these programs had "if (generating_patch)" sprinkled all over the place, but those ugliness are gone and handled uniformly from the diff core, even when not generating patch format. This also allowed diff-cache and diff-files to acquire -R (reverse) option to generate diff in reverse. Users of diff-tree can swap two trees easily so I did not add -R there. [ Linus' note: I'll add -R to "diff-tree" too, since a "commit diff" doesn't have another tree to switch around: the other tree is always the parent(s) of the commit ] Also -M<digits-as-mantissa> suggestion made by Linus has been implemented. Documentation updates are also included. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-19diff-tree: add "--root" flag to show a root commit as a big creation event.Linus Torvalds
"Let there be light"
2005-05-19[PATCH] cleanup of in-code namesAlexey Nezhdanov
Fixes all in-code names that leaved during "big name change". Signed-off-by: Alexey Nezhdanov <snake@penza-gsm.ru> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-19[PATCH] Detect renames in diff family.Junio C Hamano
This rips out the rename detection engine from diff-helper and moves it to the diff core, and updates the internal calling convention used by diff-tree family into the diff core. In order to give the same option name to diff-tree family as well as to diff-helper, I've changed the earlier diff-helper '-r' option to '-M' (stands for Move; sorry but the natural abbreviation 'r' for 'rename' is already taken for 'recursive'). Although I did a fair amount of test with the git-diff-tree with existing rename commits in the core GIT repository, this should still be considered beta (preview) release. This patch depends on the diff-delta infrastructure just committed. This implements almost everything I wanted to see in this series of patch, except a few minor cleanups in the calling convention into diff core, but that will be a separate cleanup patch. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-18diff-tree: don't match non-directories as partial pathnamesLinus Torvalds
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-18diff-tree: fix "whole sub-tree disappeared or appeared" caseLinus Torvalds
We still need to check which part of the sub-tree is interesting.
2005-05-18diff-tree: fix up comparison of "interesting" sub-treesLinus Torvalds
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-18diff-tree: show hex sha1 of the single-commit argument case correctly.Linus Torvalds
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-18diff-tree: fix and extend argument parsingLinus Torvalds
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-18diff-tree: clean up diff_tree_stdin() functionLinus Torvalds
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-06diff-tree: add author/date information to the verbose outputLinus Torvalds
2005-05-06[PATCH] Document --stdin, -m, -s, and -v flags to git-diff-treeJunio C Hamano
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-06diff-tree: add "verbose header" modeLinus Torvalds
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-06git-diff-tree: clean up outputLinus Torvalds
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-06diff-tree: support list if input trees on stdinLinus Torvalds
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-05[PATCH] git: Mention the '-p' option in the usage help string if git-diff-tree.Thomas Glanzmann
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-01Add "get_sha1()" helper function.Linus Torvalds
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-04-28[PATCH] Rename and extend read_tree_with_tree_or_commit_sha1Junio C Hamano
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-27[PATCH] diff-tree -p implies diff-tree -p -rJunio C Hamano
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[PATCH] Add -p (patch) to diff-tree.Junio C Hamano
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-26[PATCH] introduce xmalloc and xreallocChristopher Li
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-24Support a fine-grained diff-treeLinus Torvalds
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-21[PATCH] Usage-string fixes.Junio C Hamano
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-21[PATCH] Teach diff-tree about commit objectsJunio C Hamano
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-20Make "diff-tree" take commit objects too, like "diff-cache" does.Linus Torvalds
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-15Make "diff-tree" have similar behaviour as "ls-tree" wrt line termination.Linus Torvalds
Default to the human-readable '\n', but make the scriptable "-z" flag do the old '\0' behaviour.
2005-04-13[PATCH] Change diff-tree output formatPetr Baudis
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[PATCH] diff-tree usagePetr Baudis
Fix diff-tree usage, since it takes -r instead of -R now. Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-04-13[PATCH] Whitespace FixesIngo Molnar
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[PATCH] Consolidate the error handlingPetr Baudis
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-11Fix up commit-tree/diff-tree user interface issues.Linus Torvalds
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-11Fix diff-tree recursion.Linus Torvalds
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-10Simplify "diff-tree" output, and only keep track of one single name-base.Linus Torvalds
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-10Add "-R" flag to "diff-tree", so that it will recursively traverse a tree of ↵Linus Torvalds
trees as it diffs them. This makes diff-tree usable again in the new world order.
2005-04-09Add "diff-tree" program to show which files have changed between two trees.Linus Torvalds
Very useful for creating diffs efficiently, and in general to see what has changed in the namespace.