* [PATCH RESEND] checkpatch: always parse orig_commit in fixes tag
@ 2024-10-25 20:48 Tamir Duberstein
2024-10-25 21:47 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Tamir Duberstein @ 2024-10-25 20:48 UTC (permalink / raw)
To: Andy Whitcroft, Joe Perches, Dwaipayan Ray, Lukas Bulwahn,
Simon Horman, Niklas Söderlund, Andrew Morton
Cc: Tamir Duberstein, Louis Peens, linux-kernel
Do not require the presence of `$balanced_parens` to get the commit SHA;
this allows a `Fixes: deadbeef` tag to get a correct suggestion rather
than a suggestion containing a reference to HEAD.
Ironically this:
Fixes: bd17e036b495 ("checkpatch: warn for non-standard fixes tag style")
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
scripts/checkpatch.pl | 37 ++++++++++++++++---------------------
1 file changed, 16 insertions(+), 21 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4427572b24771ddb1f2bf3de3176f9437f643951..b03d526e4c454af7a42624155175e109d499762f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3209,36 +3209,31 @@ sub process {
# Check Fixes: styles is correct
if (!$in_header_lines &&
- $line =~ /^\s*fixes:?\s*(?:commit\s*)?[0-9a-f]{5,}\b/i) {
- my $orig_commit = "";
- my $id = "0123456789ab";
- my $title = "commit title";
- my $tag_case = 1;
- my $tag_space = 1;
- my $id_length = 1;
- my $id_case = 1;
+ $line =~ /^\s*(fixes:?)\s*(?:commit\s*)?([0-9a-f]{5,40})(?:\s*($balanced_parens))?/i) {
+ my $tag = $1;
+ my $orig_commit = $2;
+ my $title;
my $title_has_quotes = 0;
$fixes_tag = 1;
-
- if ($line =~ /(\s*fixes:?)\s+([0-9a-f]{5,})\s+($balanced_parens)/i) {
- my $tag = $1;
- $orig_commit = $2;
- $title = $3;
-
- $tag_case = 0 if $tag eq "Fixes:";
- $tag_space = 0 if ($line =~ /^fixes:? [0-9a-f]{5,} ($balanced_parens)/i);
-
- $id_length = 0 if ($orig_commit =~ /^[0-9a-f]{12}$/i);
- $id_case = 0 if ($orig_commit !~ /[A-F]/);
-
+ if (defined $3) {
# Always strip leading/trailing parens then double quotes if existing
- $title = substr($title, 1, -1);
+ $title = substr($3, 1, -1);
if ($title =~ /^".*"$/) {
$title = substr($title, 1, -1);
$title_has_quotes = 1;
}
+ } else {
+ $title = "commit title"
}
+
+ my $tag_case = not ($tag eq "Fixes:");
+ my $tag_space = not ($line =~ /^fixes:? [0-9a-f]{5,40} ($balanced_parens)/i);
+
+ my $id_length = not ($orig_commit =~ /^[0-9a-f]{12}$/i);
+ my $id_case = not ($orig_commit !~ /[A-F]/);
+
+ my $id = "0123456789ab";
my ($cid, $ctitle) = git_commit_info($orig_commit, $id,
$title);
---
base-commit: 3d5ad2d4eca337e80f38df77de89614aa5aaceb9
change-id: 20241019-checkpatch-fixes-commit-aa014fe6d0b3
Best regards,
-----BEGIN SSH SIGNATURE-----
U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgtYz36g7iDMSkY5K7Ab51ksGX7h
JgsMRt+XVZTrIzMVIAAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5
AAAAQEhO1Vh/OvD8e3HTwEvNpWeLJl11NLWPF00vpbfhJuWh5YZw0c1Zet+JadYOa+a6By
vg8Vjtx86wc+UjDmAJbAs=
-----END SSH SIGNATURE-----
--
Tamir Duberstein <tamird@gmail.com>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH RESEND] checkpatch: always parse orig_commit in fixes tag
2024-10-25 20:48 [PATCH RESEND] checkpatch: always parse orig_commit in fixes tag Tamir Duberstein
@ 2024-10-25 21:47 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2024-10-25 21:47 UTC (permalink / raw)
To: Tamir Duberstein
Cc: Andy Whitcroft, Joe Perches, Dwaipayan Ray, Lukas Bulwahn,
Simon Horman, Niklas Söderlund, Louis Peens, linux-kernel
On Fri, 25 Oct 2024 16:48:34 -0400 Tamir Duberstein <tamird@gmail.com> wrote:
> Do not require the presence of `$balanced_parens` to get the commit SHA;
> this allows a `Fixes: deadbeef` tag to get a correct suggestion rather
> than a suggestion containing a reference to HEAD.
Please prepare a more complete (and more understandable) description
of the issue. Including sample input and checkpatch's response to that
input would be appropriate. Then please resend.
Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-10-25 21:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-25 20:48 [PATCH RESEND] checkpatch: always parse orig_commit in fixes tag Tamir Duberstein
2024-10-25 21:47 ` Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.