Skip to contentSkip to conversation

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

DISCUSSION Andrew Wong 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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?

#1 lore raw
Quoted 3 lines · Andrew Wong

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?

#2 lore raw
In reply to Andrew Wong
Quoted 6 lines · Andrew Wong

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.