Re: blame on a deleted/renamed file
- From
Björn Steinbrink <b.steinbrink@gmx.de>
- Date
- Aug 5, 2009, 12:37 UTC
- Message-ID
- <20090805123754.GA13340@atjola.homenet>
- In-Reply-To
- <449c10960908050516k25ef0a92sd8616de29a93ea5f@mail.gmail.com>
On 2009.08.05 07:16:13 -0500, Dan McGee wrote:
Show 9 quoted lines
> Is there no easy way in git to get a blame on a file that has either > been renamed or deleted? I'll step through my thought process, and a > quick google and read of the manpage returned nothing obvious. Here is > the repository in question if it matters: > git://projects.archlinux.org/pacman.git. I located a particular commit > I was interested using a plain git-blame: > $ git blame scripts/makepkg.sh.in > > OK, looks like lines moved around enough that we got stuck here, let's
How did it get stuck? The output I see follows the changes the whole way back through scripts/makepkg.in, scripts/makepkg.in and scripts/makepkg.
Show 7 quoted lines
> see what this patch did: > $ git show e19d7da4 > > OK, it did a move of a bunch of lines into functions that GIT couldn't > quite track: > $ git annotate --follow "scripts/makepkg.in" e19d7da4~1 > fatal: cannot stat path 'scripts/makepkg.in': No such file or directory
Where does that --follow come from? I don't see that in the man page.
And scripts/makepkg.in got added in e19d7da4, so its parent didn't have it.
> $ git annotate --follow "scripts/makepkg.sh.in" e19d7da4~1 > fatal: no such path scripts/makepkg.sh.in in e19d7da4~1
Same deal, scripts/makepkg.sh.in didn't exist in e19d7da4~1 either, it got renamed from scripts/makepkg.in in b5f8a44be
> Help? Or do I need to think about writing some sort of patch for it? > This is the first thing I have seen svn be able to do[1] that git > can't. :)
Uhm, no, svn fails in the exact same way, not quite unexpected.
doener@atjola:~ $ mkdir h doener@atjola:~ $ cd h doener@atjola:h $ svnadmin create repo doener@atjola:h $ svn co file://$PWD/repo wc Checked out revision 0. doener@atjola:h $ cd wc
doener@atjola:wc $ touch foo; svn add foo; svn commit -m init A foo Adding foo Transmitting file data . Committed revision 1. doener@atjola:wc $ svn mv foo bar; svn commit -m rename A bar D foo Adding bar Deleting foo
Committed revision 2. doener@atjola:wc $ cd ..
doener@atjola:h $ svn blame file://$PWD/repo/bar doener@atjola:h $ svn blame file://$PWD/repo/bar@1 svn: '/bar' is not a file in revision 1
Björn