From: David Matlack <dmatlack@google.com>
To: Joe Perches <joe@perches.com>
Cc: linux-kernel@vger.kernel.org, David Matlack <dmatlack@google.com>
Subject: [PATCH] get_maintainer: Gracefully handle files with authors but no signers
Date: Thu, 22 Sep 2022 16:01:14 -0700 [thread overview]
Message-ID: <20220922230114.3556322-1-dmatlack@google.com> (raw)
Gracefully handle the case where a file has no signers (e.g. has not
been modified within the last year) but does have authors (e.g. because
there are local commits that modifies the file without Signed-off-by
tags). This scenario could happen for developers whose workflow is to
add Signed-off-by tags as part of git-format-patch rather than as part
of git-commit.
Today this scenario results in the following non-sensical output from
get_maintainer.pl:
Bad divisor in main::vcs_assign: 0
"GitAuthor: David Matlack" <dmatlack@google.com> (authored:1/1=100%,added_lines:9/9=100%,removed_lines:3/3=100%)
There are two issues with this output: the "Bad divisor" error and the
garbled author name. Both stem from this line in vcs_find_signers():
return (0, \@signatures, \@authors, \@stats) if !@signatures;
Returning 0 for the number of commits and a non-empty list for the
authors results in the "Bad divisor". The garbled author name comes from
the fact that @authors is the raw, unparsed, output line from git-log.
Code later in vcs_find_signers() actually parses out the name and drops
the "GitAuthor: " prefix.
Fix this by returning an empty list instead of @authors and @stats to
make them coherent with the fact that commits is 0.
Signed-off-by: David Matlack <dmatlack@google.com>
---
scripts/get_maintainer.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index ab123b498fd9..69f0e1ac9f90 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -1605,7 +1605,7 @@ sub vcs_find_signers {
# print("stats: <@stats>\n");
- return (0, \@signatures, \@authors, \@stats) if !@signatures;
+ return (0, (), (), ()) if !@signatures;
save_commits_by_author(@lines) if ($interactive);
save_commits_by_signer(@lines) if ($interactive);
base-commit: bf682942cd26ce9cd5e87f73ae099b383041e782
--
2.37.3.998.g577e59143f-goog
next reply other threads:[~2022-09-22 23:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-22 23:01 David Matlack [this message]
2022-09-22 23:43 ` [PATCH] get_maintainer: Gracefully handle files with authors but no signers Joe Perches
2022-09-27 16:57 ` David Matlack
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220922230114.3556322-1-dmatlack@google.com \
--to=dmatlack@google.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox