Re: [PATCH] Make --follow support --find-copies-harder.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 21, 2010 at 11:05 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> 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.

Ah, sorry for the confusion. I mean, I have found the bug when I use
git log. And take a look at:

git log --follow --find-copies-harder -p t/t4013/diff.show_--first-parent_master

This will report the file  t/t4013/diff.show_--first-parent_master as
a new file but it is copied from t/t4013/diff.show_master indeed.
'--find-copies-harder' should detect this, but it didn't. With this
patch it will find such copy and go on following
t/t4013/diff.show_master history.

And I locate the bug in the format of a diff test case and this cause
the confusion. What I really try to fix is,
1. --follow should support --find-copies-harder when using git-log
2. git-diff should support --find-copies-harder, I mean, diff should
find copies in unmodified files.

For 2, I find the --follow option works for git-diff, so I just take
consideration that it is the right way to support the
--find-copies-harder in git-diff. (and now I don't think so...) ;-)

>    $ 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.c
>
> As 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.

Hmm, really.

> 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.

En, as above. I just want to teach git-diff to find copies among
unmodified files with '--find-copies-harder' option. Maybe, '--follow'
is the good choice to use for control whether git-diff will detect
file move/copy, and '--find-copies-harder' is the option to control
how hard we find the copies.

I will try to make this patch into two, one for fixing the git-log
--follow --find-copies-harder one, and the other try to make a sane
logic for '--follow' for git-diff.

Thanks for your advice!

Regards!
Bo
-- 
My blog: http://blog.morebits.org
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]