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

2 messages from 2024-03-01 to 2024-03-08. Participants: Baumann, Moritz.
Thread: https://gitlist.dev/t/61032

## Baumann, Moritz, 2024-03-01 07:21

Subject: Accuracy of "git blame -C" - are there configuration options?
Message-ID: <AS1PR02MB81858FD5DDD15551754AEA74945E2@AS1PR02MB8185.eurprd02.prod.outlook.com>
URL: https://gitlist.dev/e/AS1PR02MB81858FD5DDD15551754AEA74945E2%40AS1PR02MB8185.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
```

## Baumann, Moritz, 2024-03-08 13:59

Subject: Re: Accuracy of "git blame -C" - are there configuration options?
Message-ID: <AS1PR02MB81855C978C6A42E4D6E2DE5C94272@AS1PR02MB8185.eurprd02.prod.outlook.com>
URL: https://gitlist.dev/e/AS1PR02MB81855C978C6A42E4D6E2DE5C94272%40AS1PR02MB8185.eurprd02.prod.outlook.com
In-Reply-To: <AS1PR02MB81858FD5DDD15551754AEA74945E2@AS1PR02MB8185.eurprd02.prod.outlook.com>

```
Maybe I should rephrase the question to clarify what I want to achieve:

Is there a way to execute 'git blame -C' for an entire large file at 
once and get the same accurate results as if 'git blame -C -L' had been
called for each line separately?

---
 
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
```
