[PATCH] Teach diff-tree to report unmodified paths for -C option.
- From
Junio C Hamano <junkio@cox.net>
- Date
- May 21, 2005, 10:11 UTC
- Message-ID
- <7vpsvkj3bu.fsf_-_@assigned-by-dhcp.cox.net>
- In-Reply-To
- <7vfywgkj90.fsf_-_@assigned-by-dhcp.cox.net>
Linus, I have a bit of design issue that there is no way for the diff-core layer to affect the behaviour of the caller. It is not too big a problem with others, but for diff-tree the effect is prominent.
If you do this:
./git-rev-list HEAD | ./git-diff-tree -Sdiff-tree-helper --stdin -M
you will get many uninteresting headers from git-diff-tree, until you hit something "interesting". What I want to see in this case is probably to omit the header and commit information diff-tree usually gives while "pickaxe" filters everything out (i.e. nothing interesting to report), and teach diff-tree to do the header thing only when diff-core says there is something interesting. So far I haven't found a good way to do this.
Another useless comment. For obvious reasons, there is nothing we can do about the diff-helper to add "the other half of copy detection information", because what it can tell diff-core is limited to its input, which usually is just differences prepared by somebody else, and it cannot know anything about unchanged files. When I started pushing '-p' flag to diff-tree family, I remember that your reaction was neutral to moderately negative ("I'd tolerate, although I think it is redundant and you are not even generating diff yourself anyway" as opposed to "That's just great"). I think now you would thank me for shoving the diff interface into them ;-).
I did not touch diff-tree for full-scale -C option in the last series, but if you want to have it, it is easy.
This one is untested but it should just work (TM).
Signed-off-by: Junio C Hamano <junkio@cox.net> --- # - HEAD: Diff overhaul, adding the other half of copy detection. # + (working tree)
diff --git a/diff-tree.c b/diff-tree.c --- a/diff-tree.c +++ b/diff-tree.c @@ -117,7 +117,7 @@ static int compare_tree_entry(void *tree show_file("+", tree2, size2, base); return 1; } - if (!memcmp(sha1, sha2, 20) && mode1 == mode2) + if (!memcmp(sha1, sha2, 20) && mode1 == mode2 && detect_rename < 2) return 0; /*