threads / discuss / 27573

blame -C: adding a line in moved content sometimes affect blame result

Subject: blame -C: adding a line in moved content sometimes affect blame result

## tl;dr

3 messages between Jun 8, 2011 and Jun 9, 2011.

replies: 2people: 2as markdown or json

Andrew Wong· Jun 8, 2011, 05:09 UTC · lore
I've attached a script for illustration.

After moving content from file1 to file2, "git blame -C file2" correctly shows that the content came from file1. However, if I add a line in near the top or bottom of the moved content in file2, "git blame -C file2" fails to detect that the top or bottom of the moved contents came from file1. I looked around in blame.c, and this feels like a boundary case somewhere inside find_copy_in_blob? Any clues?

Andrew Wong· Jun 9, 2011, 01:31 UTC · re: Andrew Wong · lore

Re: blame -C: adding a line in moved content sometimes affect blame result

On 11-06-08 1:09 AM, Andrew Wong wrote:
Show 8 quoted lines
> I've attached a script for illustration.
>
> After moving content from file1 to file2, "git blame -C file2" 
> correctly shows that the content came from file1. However, if I add a 
> line in near the top or bottom of the moved content in file2, "git 
> blame -C file2" fails to detect that the top or bottom of the moved 
> contents came from file1. I looked around in blame.c, and this feels 
> like a boundary case somewhere inside find_copy_in_blob? Any clues?
Anyone has any ideas regarding this issue?
Junio C Hamano· Jun 9, 2011, 03:25 UTC · re: Andrew Wong · lore

Re: blame -C: adding a line in moved content sometimes affect blame result

Andrew Wong <andrew.kw.w@gmail.com> writes:
Show 6 quoted lines
>
> After moving content from file1 to file2, "git blame -C file2"
> correctly shows that the content came from file1. However, if I add a
> line in near the top or bottom of the moved content in file2, "git
> blame -C file2" fails to detect that the top or bottom of the moved
> contents came from file1.

Probably your first few remaining lines of file2 are considered insignificant copy by the logic in step 4 described in:

    http://thread.gmane.org/gmane.comp.version-control.git/28826

I didn't actually tried to follow what the code does to your exact input, though.

← back to recent threads