From 9bf70d8641136fa81e4f13d066fb1822eb8db301 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Fri, 21 Mar 2025 15:24:22 -0700 Subject: [PATCH] refactor: Enhance git blame detection with specific similarity thresholds --- scripts/blame.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/scripts/blame.py b/scripts/blame.py index 26cab873e..cae9bbb97 100755 --- a/scripts/blame.py +++ b/scripts/blame.py @@ -224,9 +224,10 @@ def get_counts_for_file(start_tag, end_tag, authors, fname): [ "git", "blame", - "-M", - "-C", - "-C", + "-M100", # Detect moved lines within a file with 100% similarity + "-C100", # Detect moves across files with 100% similarity + "-C", # Increase detection effort + "-C", # Increase detection effort even more "--abbrev=9", f"{start_tag}..{end_tag}", "--", @@ -235,7 +236,18 @@ def get_counts_for_file(start_tag, end_tag, authors, fname): ) else: text = run( - ["git", "blame", "-M", "-C", "-C", "--abbrev=9", f"{start_tag}..HEAD", "--", fname] + [ + "git", + "blame", + "-M100", # Detect moved lines within a file with 100% similarity + "-C100", # Detect moves across files with 100% similarity + "-C", # Increase detection effort + "-C", # Increase detection effort even more + "--abbrev=9", + f"{start_tag}..HEAD", + "--", + fname + ] ) if not text: return None