Re: [PATCH] Make --follow support --find-copies-harder.
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 21, 2010, 03:05 UTC
- Message-ID
- <7vtyr5cxnz.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1271762875-16548-1-git-send-email-struggleyb.nku@gmail.com>
Bo Yang <struggleyb.nku@gmail.com> writes:
> 'git diff --follow <commit1> <commit2> <path>' give users > the content difference of <path> between the two commits. > It will detect file copies/moves of <path> if there is any.
Because the "--follow" hack was done primarily as a "checkbox" item, and also because it is not an option for the "diff" family (it is an option for the "log" family), I would personally think that it is actually a bug that "git diff" accepts "--follow" and pretends as if it is doing useful work, but does so only some of the time.
$ git diff --follow --name-status maint master -- builtin/log.c
R089 builtin-log.c builtin/log.c
$ git diff --follow --name-status -R maint master -- builtin/log.c
D builtin/log.c
$ git diff --follow --name-status master maint -- builtin/log.c
D builtin/log.cAs we can see, it doesn't quite work, and it is not a fault of 750f7b6 (Finally implement "git log --follow", 2007-06-19) by Linus, exactly because the feature wasn't designed to work with "diff" to begin with.
If we were to add a support of "--follow" to "diff" family, I suspect that we need to
(1) make sure we get only one path, just like "log" family does;
(2) add a logic to notice the reverse situation as demonstrated above and
deal with it in a sensible way, without any --find-copies option
given by the user.among other things. Also we of course need to document it as a new "diff" option when we are done.