From 133bb0491e01d41082207e0ef9658967f7c7483d Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Mon, 29 Jul 2024 11:05:33 -0300 Subject: [PATCH] Add support to identify aider-written commits by checking the commit message --- scripts/blame.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/blame.py b/scripts/blame.py index 7b40a34a0..12355e9c7 100755 --- a/scripts/blame.py +++ b/scripts/blame.py @@ -60,6 +60,9 @@ def get_commit_authors(commits): commit_to_author = dict() for commit in commits: author = run(["git", "show", "-s", "--format=%an", commit]).strip() + commit_message = run(["git", "show", "-s", "--format=%s", commit]).strip() + if commit_message.lower().startswith("aider:"): + author += " (aider)" commit_to_author[commit] = author return commit_to_author @@ -107,9 +110,6 @@ def get_counts_for_file(start_tag, end_tag, authors, fname): continue hsh = line[:hash_len] author = authors.get(hsh, "Unknown") - # Normalize author names with "(aider)" to a single format - if "(aider)" in author.lower(): - author = re.sub(r'\s*\(aider\)', ' (aider)', author, flags=re.IGNORECASE) line_counts[author] += 1 return dict(line_counts)