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

Accuracy of "git blame -C" - are there configuration options?

From
Baumann, Moritz <moritz.baumann@sap.com>
Date
Mar 1, 2024, 07:21 UTC
Message-ID
<AS1PR02MB81858FD5DDD15551754AEA74945E2@AS1PR02MB8185.eurprd02.prod.outlook.com>
Hi,

A colleague recently experimented with "git blame -C" and noticed that the accuracy with which git detects lines moved from other files varies a lot depending on the sizes of the files involved.

Example repository: https://github.com/Boddlnagg/git-blame-problem

The latest commit on all branches moves some lines from Decl.cpp to line 93 of DeclBase.cpp. "git blame -C" doesn't detect this on main, but on the "works-as-expected" branch, in which the size of Decl.cpp was artificially reduced, it does.

Further experiments show that the following work as well: git blame -L 93,95 -C main -- DeclBase.cpp git blame -L 80,108 -C main -- DeclBase.cpp

However, with a sufficiently large range, it stops working again: git blame -L 80,109 -C main -- DeclBase.cpp

How does the pickaxe search of git blame work under the hood? Are there any configuration options I can use if I want to trade performance for accuracy?

Best regards, Moritz Baumann

Next: Baumann, Moritz
Message 1 of 2 in “Accuracy of "git blame -C" - are there configuration options?”
  1. Baumann, MoritzMar 1, 2024
  2. Baumann, MoritzMar 8, 2024

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.