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

Re: git blame --follow

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 15, 2011, 17:30 UTC
Message-ID
<7vy64g9tqs.fsf@alter.siamese.dyndns.org>
In-Reply-To
<201103151644.44360.wolfgang@rohdewald.de>
Wolfgang Rohdewald <wolfgang@rohdewald.de> writes:
Show 8 quoted lines
> git log --follow filename
>
> shows the full history, while
>
> git blame --follow filename
>
> blames everything to the latest commit (which was
> a file rename)
Huh?
    $ git checkout master^0
    $ git mv COPYING RENAMING
    $ git commit -m renamed
    $ git blame --follow RENAMING

gives everything blamed to 075b845a COPYING (but that is probably by accident, see below). FYI,

    $ git blame RENAMING

should also blame everything to the same commit and the same COPYING file. If you get a different behaviour out of the above command sequence, there is something else going on.

I didn't know "blame" even accepted "--follow". It is entirely out of the scope of its design to take "--follow" option, as the "blame" command itself has its own and real "follow" logic that is enabled by default (i.e. it follows a whole file rename without any option), instead of the checkbox "--follow" hack that is in "git log" family of commands. You cannot even turn it off.

Perhaps the behaviour you saw comes from the internal revision traversal machinery blame uses getting confused by the use of --follow, but I am too lazy to check (and I don't think it is worth to check, as the command should follow by default).

We should just teach "blame" to ignore --follow option from the command line, without even complaining.

Previous: Wolfgang RohdewaldNext: Wolfgang Rohdewald
Message 2 of 6 in “git blame --follow”
  1. Wolfgang RohdewaldMar 15, 2011
  2. Junio C HamanoMar 15, 2011
  3. Wolfgang RohdewaldMar 15, 2011
  4. Jakub NarebskiMar 17, 2011
  5. Wolfgang RohdewaldMar 17, 2011
  6. Jakub NarebskiMar 17, 2011

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.