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

Possible git blame bug?

From
DSDomagoj Stolfa <domagoj.stolfa@gmail.com>
Date
Mar 13, 2017, 20:11 UTC
Message-ID
<20170313201104.GA32821@workstation>
Hello,

yesterday I came across sort of a weird behaviour with git-blame. It would appear when one queries the git blame on a specific file, such as:

$ git blame <file> --since=<year>

it will blame the entire file on some commit of that year, regardless of the fact whether the commit has actually touched that file or not.

This seems consistent across all the tested systems: FreeBSD, macOS, Ubuntu and Fedora.

An example of the blame can be seen:

$ git blame tcp_output.c cd0bc69e2fdd (wollman 1995-09-22 20:05:58 +0000 29) * @(#)tcp_output.c 8.4 (Berkeley) 5/24/95

compared to:

$ git blame tcp_output.c --since=2017 ^e19f2a27ed8 (Domagoj Stolfa 2017-03-12 20:43:01 +0100 29) * @(#)tcp_output.c 8.4 (Berkeley) 5/24/95

$ git blame tcp_output.c --since=2016 ^e4bdb83e76c (jceel 2016-03-13 19:50:17 +0000 29) * @(#)tcp_output.c 8.4 (Berkeley) 5/24/95

$ git blame tcp_output.c --since=2015 ^d749a6e6c70 (pfg 2015-03-13 18:42:43 +0000 29) * @(#)tcp_output.c 8.4 (Berkeley) 5/24/95

Of course, specifiying
$ git blame --since=1.1.2017
gives correct results, as expected.

The question is whether this is a bug or not, as --since=<year> might not be a valid filter. However, this might surprise a lot of users and mislead development. I would personally like to see this behaviour changed to either a blank report, a report of that year(making it a valid filter), but certainly not blaming it on commits that have never touched that file.

-- 
Best regards,
Domagoj Stolfa
Next: Junio C Hamano
Message 1 of 10 in “Possible git blame bug?”
  1. Domagoj StolfaMar 13, 2017
  2. Junio C HamanoMar 13, 2017
  3. Junio C HamanoMar 13, 2017
  4. Domagoj StolfaMar 13, 2017
  5. Junio C HamanoMar 13, 2017
  6. Junio C HamanoMar 13, 2017
  7. Domagoj StolfaMar 13, 2017
  8. Junio C HamanoMar 13, 2017
  9. Domagoj StolfaMar 13, 2017
  10. Domagoj StolfaMar 13, 2017

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.