refactor: Enhance git blame detection with specific similarity thresholds

This commit is contained in:
Paul Gauthier (aider) 2025-03-21 15:24:22 -07:00
parent 0eb26fffe1
commit 9bf70d8641

View file

@ -224,9 +224,10 @@ def get_counts_for_file(start_tag, end_tag, authors, fname):
[ [
"git", "git",
"blame", "blame",
"-M", "-M100", # Detect moved lines within a file with 100% similarity
"-C", "-C100", # Detect moves across files with 100% similarity
"-C", "-C", # Increase detection effort
"-C", # Increase detection effort even more
"--abbrev=9", "--abbrev=9",
f"{start_tag}..{end_tag}", f"{start_tag}..{end_tag}",
"--", "--",
@ -235,7 +236,18 @@ def get_counts_for_file(start_tag, end_tag, authors, fname):
) )
else: else:
text = run( 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: if not text:
return None return None