]> git.ipfire.org Git - thirdparty/git.git/commit
blame: allow to blame paths freshly added to the index
authorMike Hommey <mh@glandium.org>
Fri, 15 Jul 2016 23:23:45 +0000 (08:23 +0900)
committerJunio C Hamano <gitster@pobox.com>
Mon, 18 Jul 2016 21:33:38 +0000 (14:33 -0700)
commit3b75ee93278179004bc2f117fcfe3d5d76a0a2fa
tree86f8d5603b6030f76206ec1f1beac1eb3d6ff45b
parent0b65a8dbdb38962e700ee16776a3042beb489060
blame: allow to blame paths freshly added to the index

When blaming files, changes in the work tree are taken into account
and displayed as being "Not Committed Yet".

However, when blaming a file that is not known to the current HEAD,
git blame fails with `no such path 'foo' in HEAD`, even when the file
was git add'ed.

Allowing such a blame is useful when the new file added to the index
(not yet committed) was created by renaming an existing file.  It
also is useful when the new file was created from pieces already in
HEAD, moved or copied from other files and blaming with copy
detection (i.e. "-C").

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/blame.c
t/t8003-blame-corner-cases.sh