diff options
author | Linus Torvalds <torvalds@osdl.org> | 2006-02-09 10:30:28 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-02-09 11:46:05 -0800 |
commit | ee63802422af14e43eccce3c6dc4150a27ceb1a3 (patch) | |
tree | 8f43c1d4744b90ac5608d0c073fa24815660667e /diff-tree.c | |
parent | d19e06fa8f86b611c10115903ef7e50d5de112f0 (diff) | |
download | git-ee63802422af14e43eccce3c6dc4150a27ceb1a3.tar.gz |
diff-tree -c raw output
NOTE! This makes "-c" be the default, which effectively means that merges
are never ignored any more, and "-m" is a no-op. So it changes semantics.
I would also like to make "--cc" the default if you do patches, but didn't
actually do that.
The raw output format is not wonderfully pretty, but it's distinguishable
from a "normal patch" in that a normal patch with just one parent has just
one colon at the beginning, while a multi-parent raw diff has <n> colons
for <n> parents.
So now, in the kernel, when you do
git-diff-tree cce0cac125623f9b68f25dd1350f6d616220a8dd
(to see the manual ARM merge that had a conflict in arch/arm/Kconfig), you
get
cce0cac125623f9b68f25dd1350f6d616220a8dd
::100644 100644 100644 4a63a8e2e45247a11c068c6ed66c6e7aba29ddd9 77eee38762d69d3de95ae45dd9278df9b8225e2c 2f61726d2f4b636f6e66696700dbf71a59dad287 arch/arm/Kconfig
ie you see two colons (two parents), then three modes (parent modes
followed by result mode), then three sha1s (parent sha1s followed by
result sha1).
Which is pretty close to the normal raw diff output.
Cool/stupid exercise:
$ git-whatchanged | grep '^::' | cut -f2- | sort |
uniq -c | sort -n | less -S
will show which files have needed the most file-level merge conflict
resolution. Useful? Probably not. But kind of interesting.
For the kernel, it's
....
10 arch/ia64/Kconfig
11 drivers/scsi/Kconfig
12 drivers/net/Makefile
17 include/linux/libata.h
18 include/linux/pci_ids.h
23 drivers/net/Kconfig
24 drivers/scsi/libata-scsi.c
28 drivers/scsi/libata-core.c
43 MAINTAINERS
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'diff-tree.c')
-rw-r--r-- | diff-tree.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/diff-tree.c b/diff-tree.c index 7148323348..df6fd97fca 100644 --- a/diff-tree.c +++ b/diff-tree.c @@ -6,7 +6,7 @@ static int show_root_diff = 0; static int no_commit_id = 0; static int verbose_header = 0; static int ignore_merges = 1; -static int combine_merges = 0; +static int combine_merges = 1; static int dense_combined_merges = 0; static int read_stdin = 0; static int always_show_header = 0; @@ -117,8 +117,12 @@ static int diff_tree_commit(struct commit *commit) return 0; else if (combine_merges) { header = generate_header(sha1, sha1, commit); - return diff_tree_combined_merge(sha1, header, - dense_combined_merges); + header = diff_tree_combined_merge(sha1, header, + dense_combined_merges, + &diff_options); + if (!header && verbose_header) + header_prefix = "\ndiff-tree "; + return 0; } } @@ -285,10 +289,12 @@ int main(int argc, const char **argv) usage(diff_tree_usage); } - if (combine_merges) { - diff_options.output_format = DIFF_FORMAT_PATCH; + if (combine_merges) ignore_merges = 0; - } + + /* We can only do dense combined merges with diff output */ + if (dense_combined_merges) + diff_options.output_format = DIFF_FORMAT_PATCH; if (diff_options.output_format == DIFF_FORMAT_PATCH) diff_options.recursive = 1; |