aboutsummaryrefslogtreecommitdiffstats
path: root/diff-tree.c
AgeCommit message (Collapse)AuthorFilesLines
2005-09-24Diff clean-up.Junio C Hamano1-92/+39
This is a long overdue clean-up to the code for parsing and passing diff options. It also tightens some constness issues. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-15Plug diff leaks.Junio C Hamano1-0/+1
It is a bit embarrassing that it took this long for a fix since the problem was first reported on Aug 13th. Message-ID: <87y876gl1r.wl@mail2.atmark-techno.com> From: Yasushi SHOJI <yashi@atmark-techno.com> Newsgroups: gmane.comp.version-control.git Subject: [patch] possible memory leak in diff.c::diff_free_filepair() Date: Sat, 13 Aug 2005 19:58:56 +0900 This time I used valgrind to make sure that it does not overeagerly discard memory that is still being used. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-16[PATCH] Make "git diff" work inside relative subdirectoriesLinus Torvalds1-4/+13
We always show the diff as an absolute path, but pathnames to diff are taken relative to the current working directory (and if no pathnames are given, the default ends up being all of the current working directory). Note that "../xyz" also works, so you can do cd linux/drivers/char git diff ../block and it will generate a diff of the linux/drivers/block changes. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-29[PATCH] Unify usage strings declarationPetr Baudis1-1/+1
All usage strings are now declared as static const char []. This is carried over from my old git-pb branch. Signed-off-by: Petr Baudis <pasky@ucw.cz> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-14Split up "diff_format" into "format" and "line_termination".Linus Torvalds1-9/+6
This removes the separate "formats" for name and name-with-zero- termination. It also removes the difference between HUMAN and MACHINE formats, and they both become DIFF_FORMAT_RAW, with the difference being just in the line and inter-filename termination. It also makes the code easier to understand.
2005-07-13[PATCH] Clean up diff option descriptions.Junio C Hamano1-1/+3
I got tired of maintaining almost duplicated descriptions in diff-* brothers, both in usage string and documentation. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-13[PATCH] git-diff-*: --name-only and --name-only-z.Junio C Hamano1-0/+8
Porcelain layers often want to find only names of changed files, and even with diff-raw output format they end up having to pick out only the filename. Support --name-only (and --name-only-z for xargs -0 and cpio -0 users that want to treat filenames with embedded newlines sanely) flag to help them. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-08git-diff-*: support "-u" as a synonym for "-p"Linus Torvalds1-1/+1
I'm probably not the only one whose fingers have gotten hard-wired to use "-u" for "unified diff".
2005-06-26Add "--pretty=full" format that also shows committer.Linus Torvalds1-13/+0
Also move the common implementation of parsing the --pretty argument format into commit.c rather than having duplicates in diff-tree.c and rev-list.c.
2005-06-23Clean up git-diff-tree 'header' generationLinus Torvalds1-12/+6
2005-06-19[PATCH] Make -C less eager.Junio C Hamano1-3/+3
Like diff-tree, this patch makes -C option for diff-* brothers to use only pre-image of modified files as rename/copy detection by default. Give --find-copies-harder to use unmodified files to find copies from as well. This also fixes "diff-files -C" problem earlier noticed by Linus. It was feeding the null sha1 even when the file in the work tree was known to match what is in the index file. This resulted in diff-files showing everything in the project. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-12[PATCH] Add --diff-filter= output restriction to diff-* family.Junio C Hamano1-3/+9
This is a halfway between debugging aid and a helper to write an ultra-smart merge scripts. The new option takes a string that consists of a list of "status" letters, and limits the diff output to only those classes of changes, with two exceptions: - A broken pair (aka "complete rewrite"), does not match D (deleted) or N (created). Use B to look for them. - The letter "A" in the diff-filter string does not match anything itself, but causes the entire diff that contains selected patches to be output (this behaviour is similar to that of --pickaxe-all for the -S option). For example, $ git-rev-list HEAD | git-diff-tree --stdin -s -v -B -C --diff-filter=BCR shows a list of commits that have complete rewrite, copy, or rename. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-12[PATCH] diff-tree: --find-copies-harderJunio C Hamano1-3/+10
Normally, diff-tree does not feed unchanged filepair to diffcore for performance reasons, so copies are detected only when the source file of the copy happens to be modified in the same changeset. This adds --find-copies-harder flag to tell diff-tree to sacrifice the performance in order to find copies the same way as other commands in diff-* family. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-12git-diff-tree: fix output with just "--pretty".Linus Torvalds1-0/+1
It set verbose, but didn't set the output prefix to "diff-tree".
2005-06-12[PATCH] Support commit_format in diff-treeJunio C Hamano1-1/+19
This steals --pretty command line option from rev-list and teaches diff-tree to do the same. With this change, $ git-whatchanged --pretty would work as expected. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-05pretty_print_commit: add different formatsLinus Torvalds1-1/+2
You can ask to print out "raw" format (full headers, full body), "medium" format (author and date, full body) or "short" format (author only, condensed body). Use "git-rev-list --pretty=short HEAD | less -S" for an example.
2005-06-03[PATCH] diff: Clean up diff_scoreopt_parse().Junio C Hamano1-3/+6
This cleans up diff_scoreopt_parse() function that is used to parse the fractional notation -B, -C and -M option takes. The callers are modified to check for errors and complain. Earlier they silently ignored malformed input and falled back on the default. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-03[PATCH] diff: Fix docs and add -O to diff-helper.Junio C Hamano1-1/+1
This patch updates diff documentation and usage strings: - clarify the semantics of -R. It is not "output in reverse"; rather, it is "I will feed diff backwards". Semantically they are different when -C is involved. - describe -O in usage strings of diff-* brothers. It was implemented, documented but not described in usage text. Also it adds -O to diff-helper. Like -S (and unlike -M/-C/-B), this option can work on sanitized diff-raw output produced by the diff-* brothers. While we are at it, the call it makes to diffcore is cleaned up to use the diffcore_std() like everybody else, and the declaration for the low level diffcore routines are moved from diff.h (public) to diffcore.h (private between diff.c and diffcore backends). Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-01[PATCH] diff: mode bits fixesJunio C Hamano1-1/+3
The core GIT repository has trees that record regular file mode in 0664 instead of normalized 0644 pattern. Comparing such a tree with another tree that records the same file in 0644 pattern without content changes with git-diff-tree causes it to feed otherwise unmodified pairs to the diff_change() routine, which triggers a sanity check routine and barfs. This patch fixes the problem, along with the fix to another caller that uses unnormalized mode bits to call diff_change() routine in a similar way. Without this patch, you will see "fatal error" from diff-tree when you run git-deltafy-script on the core GIT repository itself. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-01Add generic commit "pretty print" function.Linus Torvalds1-69/+3
It's really just the header printign function from diff-tree.c, and it's usable for other things too.
2005-05-30[PATCH] Add -O<orderfile> option to diff-* brothers.Junio C Hamano1-1/+7
A new diffcore filter diffcore-order is introduced. This takes a text file each of whose line is a shell glob pattern. Patches that match a glob pattern on an earlier line in the file are output before patches that match a later line, and patches that do not match any glob pattern are output last. A typical orderfile for git project probably should look like this: README Makefile Documentation *.h *.c Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-30[PATCH] Add -B flag to diff-* brothers.Junio C Hamano1-1/+7
A new diffcore transformation, diffcore-break.c, is introduced. When the -B flag is given, a patch that represents a complete rewrite is broken into a deletion followed by a creation. This makes it easier to review such a complete rewrite patch. The -B flag takes the same syntax as the -M and -C flags to specify the minimum amount of non-source material the resulting file needs to have to be considered a complete rewrite, and defaults to 99% if not specified. As the new test t4008-diff-break-rewrite.sh demonstrates, if a file is a complete rewrite, it is broken into a delete/create pair, which can further be subjected to the usual rename detection if -M or -C is used. For example, if file0 gets completely rewritten to make it as if it were rather based on file1 which itself disappeared, the following happens: The original change looks like this: file0 --> file0' (quite different from file0) file1 --> /dev/null After diffcore-break runs, it would become this: file0 --> /dev/null /dev/null --> file0' file1 --> /dev/null Then diffcore-rename matches them up: file1 --> file0' The internal score values are finer grained now. Earlier maximum of 10000 has been raised to 60000; there is no user visible changes but there is no reason to waste available bits. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-30[PATCH] diff: consolidate various calls into diffcore.Junio C Hamano1-4/+3
The three diff-* brothers had a sequence of calls into diffcore that were almost identical. Introduce a new diffcore_std() function that takes all the necessary arguments to consolidate it. This will make later enhancements and changing the order of diffcore application simpler. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-29[PATCH] Optimize diff-tree -[CM] --stdinJunio C Hamano1-0/+3
This attempts to optimize "diff-tree -[CM] --stdin", which compares successible tree pairs. This optimization does not make much sense for other commands in the diff-* brothers. When reading from --stdin and using rename/copy detection, the patch makes diff-tree to read the current index file first. This is done to reuse the optimization used by diff-cache in the non-cached case. Similarity estimator can avoid expanding a blob if the index says what is in the work tree has an exact copy of that blob already expanded. Another optimization the patch makes is to check only file sizes first to terminate similarity estimation early. In order for this to work, it needs a way to tell the size of the blob without expanding it. Since an obvious way of doing it, which is to keep all the blobs previously used in the memory, is too costly, it does so by keeping the filesize for each object it has already seen in memory. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-29[PATCH] Add --pickaxe-all to diff-* brothers.Junio C Hamano1-1/+6
When --pickaxe-all is given in addition to -S, pickaxe shows the entire diffs contained in the changeset, not just the diffs for the filepair that touched the sought-after string. This is useful to see the changes in context. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-29[PATCH] Clean up diff_setup() to make it more extensible.Junio C Hamano1-3/+3
This changes the argument of diff_setup() from an integer that says if we are feeding reversed diff to a bitmask, so that later global options can be added more easily. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-27git-diff-tree: simplify header output with '-z'Linus Torvalds1-12/+5
No need to make them multiple lines, in fact we explicitly don't want that. This also fixes a 64-bit problem pointed out by Markus F.X.J. Oberhumer, where we gave "%.*s" a "ptrdiff_t" length argument instead of an "int".
2005-05-26git-diff-tree: don't use diffcore_pathspec()Linus Torvalds1-2/+0
diff-tree does the culling of uninteresting paths internally, and fundamentally has to do so for performance reasons. So there's no point in calling the separate pathname culling logic here, especially as it seems slightly broken.
2005-05-25[PATCH] show changed tree objects with recursive git-diff-treeJunio C Hamano1-1/+8
This adds a "-t" flag to tell the raw diff output to include the tree objects in the output when doing a recursive diff. Since that's how the non-recursive output already handles trees and the flag thus doesn't make sense without "-r", I made "-t" imply "-r". Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-24[PATCH] Use DIFF_FORMAT_NO_OUTPUT to implement diff-tree -s option.Junio C Hamano1-12/+2
Instead of checking silent flag all over the place, simply use the NO_OUTPUT option diffcore provides to suppress the diff output. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-23[PATCH] Fix diff-pruning logic which was running prune too early.Junio C Hamano1-2/+0
For later stages to reorder patches, pruning logic and rename detection logic should not decide which delete to discard (because another entry said it will take over the file as a rename) until the very end. Also fix some tests that were assuming the earlier "last one is rename or keep everything else is copy" semantics of diff-raw format, which no longer is true. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-23diff-tree: don't write headers if the diff queue is emptyLinus Torvalds1-5/+5
This is not a pickaxe-specific thing, we do this regardless of what has pruned down the diff queue.
2005-05-23[PATCH] diff-raw format update take #2.Junio C Hamano1-2/+2
This changes the diff-raw format again, following the mailing list discussion. The new format explicitly expresses which one is a rename and which one is a copy. The documentation and tests are updated to match this change. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-23[PATCH] NUL terminate diff-tree header lines under -z.Junio C Hamano1-1/+12
Thomas Glanzmann noticed that diff-tree -z HEAD piped to diff-helper -z did not work. Since diff-helper -z expects NUL terminated lines, we should generate such. The output side of the diff-helper should always be using '\n' termination; earlier it used the same line_termination used for the input side, which was a mistake. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-22Some more sparse warning fixesLinus Torvalds1-1/+1
Proper function declarations and NULL pointer usage.
2005-05-22[PATCH] Diffcore updates.Junio C Hamano1-20/+24
This moves the path selection logic from individual programs to a new diffcore transformer (diff-tree still needs to have its own for performance reasons). Also the header printing code in diff-tree was tweaked not to produce anything when pickaxe is in effect and there is nothing interesting to report. An interesting example is the following in the GIT archive itself: $ git-whatchanged -p -C -S'or something in a real script' Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-21[PATCH] The diff-raw format updates.Junio C Hamano1-7/+6
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-21[PATCH] Prepare diffcore interface for diff-tree header supression.Junio C Hamano1-8/+18
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 Torvalds1-1/+8
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 Hamano1-1/+1
Constness fix for pickaxe option. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-21diff-tree: prettify output slightlyLinus Torvalds1-3/+16
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 Hamano1-5/+10
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 Hamano1-1/+7
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 Torvalds1-5/+5
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 Torvalds1-1/+1
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-19Fix up previous commitLinus Torvalds1-3/+8
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-19[PATCH] diff overhaulJunio C Hamano1-31/+15
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 Torvalds1-6/+35
"Let there be light"
2005-05-19[PATCH] cleanup of in-code namesAlexey Nezhdanov1-2/+2
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 Hamano1-4/+21
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 Torvalds1-0/+2
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 Torvalds1-9/+11
We still need to check which part of the sub-tree is interesting.
2005-05-18diff-tree: fix up comparison of "interesting" sub-treesLinus Torvalds1-0/+5
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 Torvalds1-1/+7
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 Torvalds1-11/+27
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 Torvalds1-21/+27
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 Torvalds1-1/+24
2005-05-06[PATCH] Document --stdin, -m, -s, and -v flags to git-diff-treeJunio C Hamano1-1/+2
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 Torvalds1-3/+58
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 Torvalds1-3/+27
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 Torvalds1-9/+77
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 Glanzmann1-1/+1
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 Torvalds1-1/+1
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 Hamano1-2/+2
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 Hamano1-1/+1
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 Hamano1-9/+26
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 Li1-2/+2
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-23Support a fine-grained diff-treeLinus Torvalds1-2/+76
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-20[PATCH] Usage-string fixes.Junio C Hamano1-2/+4
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[PATCH] Teach diff-tree about commit objectsJunio C Hamano1-21/+4
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-19Make "diff-tree" take commit objects too, like "diff-cache" does.Linus Torvalds1-0/+16
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 Torvalds1-3/+10
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 Baudis1-2/+6
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 Baudis1-1/+1
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 Molnar1-1/+1
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 Baudis1-6/+6
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 Torvalds1-1/+1
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-10Fix diff-tree recursion.Linus Torvalds1-6/+53
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 Torvalds1-24/+23
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 Torvalds1-21/+59
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 Torvalds1-0/+109
Very useful for creating diffs efficiently, and in general to see what has changed in the namespace.