* [RFC][PATCH] checkpatch: require Fixes tag for fixup patches
@ 2021-11-30 11:15 Sergey Senozhatsky
2022-01-11 5:47 ` Sergey Senozhatsky
0 siblings, 1 reply; 2+ messages in thread
From: Sergey Senozhatsky @ 2021-11-30 11:15 UTC (permalink / raw)
To: Joe Perches, Andy Whitcroft; +Cc: linux-kernel, Sergey Senozhatsky
Require "Fixes: hash" tag in those patches that appear to be
fixing some particular commit.
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
---
scripts/checkpatch.pl | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index df8b23dc1eb0..4e97d0f6b995 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2493,6 +2493,9 @@ sub process {
my $commit_log_has_diff = 0;
my $reported_maintainer_file = 0;
my $non_utf8_charset = 0;
+ my $fixes_id = 0;
+ my $fixes_description = 0;
+ my $fixes_tag = 0;
my $last_blank_line = 0;
my $last_coalesced_string_linenr = -1;
@@ -3076,6 +3079,11 @@ sub process {
}
}
+# Check for Fixes tag
+ if ($in_commit_log && $line =~ /\b[Ff]ixes:\s*[0-9a-f]{12,40}/) {
+ $fixes_tag = 1;
+ }
+
# Check for git id commit length and improperly formed commit descriptions
if ($in_commit_log && !$commit_log_possible_stack_dump &&
$line !~ /^\s*(?:Link|Patchwork|http|https|BugLink|base-commit):/i &&
@@ -3128,6 +3136,11 @@ sub process {
($id, $description) = git_commit_info($orig_commit,
$id, $orig_desc);
+ if (defined($id)) {
+ $fixes_id = $id;
+ $fixes_description = $description;
+ }
+
if (defined($id) &&
($short || $long || $space || $case || ($orig_desc ne $description) || !$hasparens)) {
ERROR("GIT_COMMIT_ID",
@@ -7326,6 +7339,12 @@ sub process {
}
}
+ if ($is_patch && $has_commit_log && $fixes_id && !$fixes_tag) {
+ ERROR("GIT_COMMIT_ID",
+ "Please add 'Fixes: $fixes_id (\"$fixes_description\")'\n", );
+ $fixes_id = 0;
+ }
+
print report_dump();
if ($summary && !($clean == 1 && $quiet == 1)) {
print "$filename " if ($summary_file);
--
2.34.0.rc2.393.gf8c9666880-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RFC][PATCH] checkpatch: require Fixes tag for fixup patches
2021-11-30 11:15 [RFC][PATCH] checkpatch: require Fixes tag for fixup patches Sergey Senozhatsky
@ 2022-01-11 5:47 ` Sergey Senozhatsky
0 siblings, 0 replies; 2+ messages in thread
From: Sergey Senozhatsky @ 2022-01-11 5:47 UTC (permalink / raw)
To: Joe Perches, Andy Whitcroft; +Cc: Sergey Senozhatsky, linux-kernel
On (21/11/30 20:15), Sergey Senozhatsky wrote:
>
> Require "Fixes: hash" tag in those patches that appear to be
> fixing some particular commit.
Gentle ping.
> Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
> ---
> scripts/checkpatch.pl | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index df8b23dc1eb0..4e97d0f6b995 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2493,6 +2493,9 @@ sub process {
> my $commit_log_has_diff = 0;
> my $reported_maintainer_file = 0;
> my $non_utf8_charset = 0;
> + my $fixes_id = 0;
> + my $fixes_description = 0;
> + my $fixes_tag = 0;
>
> my $last_blank_line = 0;
> my $last_coalesced_string_linenr = -1;
> @@ -3076,6 +3079,11 @@ sub process {
> }
> }
>
> +# Check for Fixes tag
> + if ($in_commit_log && $line =~ /\b[Ff]ixes:\s*[0-9a-f]{12,40}/) {
> + $fixes_tag = 1;
> + }
> +
> # Check for git id commit length and improperly formed commit descriptions
> if ($in_commit_log && !$commit_log_possible_stack_dump &&
> $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink|base-commit):/i &&
> @@ -3128,6 +3136,11 @@ sub process {
> ($id, $description) = git_commit_info($orig_commit,
> $id, $orig_desc);
>
> + if (defined($id)) {
> + $fixes_id = $id;
> + $fixes_description = $description;
> + }
> +
> if (defined($id) &&
> ($short || $long || $space || $case || ($orig_desc ne $description) || !$hasparens)) {
> ERROR("GIT_COMMIT_ID",
> @@ -7326,6 +7339,12 @@ sub process {
> }
> }
>
> + if ($is_patch && $has_commit_log && $fixes_id && !$fixes_tag) {
> + ERROR("GIT_COMMIT_ID",
> + "Please add 'Fixes: $fixes_id (\"$fixes_description\")'\n", );
> + $fixes_id = 0;
> + }
> +
> print report_dump();
> if ($summary && !($clean == 1 && $quiet == 1)) {
> print "$filename " if ($summary_file);
> --
> 2.34.0.rc2.393.gf8c9666880-goog
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-11 5:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30 11:15 [RFC][PATCH] checkpatch: require Fixes tag for fixup patches Sergey Senozhatsky
2022-01-11 5:47 ` Sergey Senozhatsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).