git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Dan McGeeNext: Matthieu Moy
Message 2 of 8 in “blame on a deleted/renamed file”
  1. Dan McGeeAug 5, 2009
  2. Björn SteinbrinkAug 5, 2009
  3. Matthieu MoyAug 5, 2009
  4. Dan McGeeAug 5, 2009
  5. Björn SteinbrinkAug 5, 2009
  6. Thomas RastAug 5, 2009
  7. Junio C HamanoAug 5, 2009
  8. Björn SteinbrinkAug 5, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.