Skip to contentSkip to conversation

checkpatch: Don't show signatures in git-log

PATCH In review Palmer Dabbelt 2 participants 2 messages Jul 6, 2021 – Jul 7, 2021 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: Don't show signatures in git-log

From: Palmer Dabbelt <[email protected]>

I have git-log setup to show signatures. I've recently noticed this breaking checkpatch error messages, which show something like

ERROR: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'commit gpg: Signatu (":05 PM PDT")' #8:
the module region by 3a02764c372c ("riscv: Ensure BPF_JIT_REGION_START

instead of something more helpful, like

ERROR: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'commit 3a02764c372c ("riscv: Ensure BPF_JIT_REGION_START aligned with PMD size")' #8:
the module region by 3a02764c372c ("riscv: Ensure BPF_JIT_REGION_START

which shows up with this patch. I'm not sure if these just started showing up for if I just noticed them or if they've been around forever.

I've only found it necessary to add --no-show-signature to the git-log invocation in git_commit_info(), but a cursory glance indicates that the other two invocations may suffer from similar problems so I've just added it everywhere.

---
 scripts/checkpatch.pl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/checkpatch.pl +3 -3
index 461d4221e4a4..4df508b4915d 100755
@@ -1103,7 +1103,7 @@ sub seed_camelcase_includes {
 	$camelcase_seeded = 1;
 
 	if (-e "$gitroot") {
-		my $git_last_include_commit = `${git_command} log --no-merges --pretty=format:"%h%n" -1 -- include`;
+		my $git_last_include_commit = `${git_command} log --no-show-signature --no-merges --pretty=format:"%h%n" -1 -- include`;
 		chomp $git_last_include_commit;
 		$camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit";
 	} else {
@@ -1165,7 +1165,7 @@ sub git_commit_info {
 
 	return ($id, $desc) if ((which("git") eq "") || !(-e "$gitroot"));
 
-	my $output = `${git_command} log --no-color --format='%H %s' -1 $commit 2>&1`;
+	my $output = `${git_command} log --no-color --no-show-signature --format='%H %s' -1 $commit 2>&1`;
 	$output =~ s/^\s*//gm;
 	my @lines = split("\n", $output);
 
@@ -1215,7 +1215,7 @@ if ($git) {
 		} else {
 			$git_range = "-1 $commit_expr";
 		}
-		my $lines = `${git_command} log --no-color --no-merges --pretty=format:'%H %s' $git_range`;
+		my $lines = `${git_command} log --no-show-signature --no-color --no-merges --pretty=format:'%H %s' $git_range`;
 		foreach my $line (split(/\n/, $lines)) {
 			$line =~ /^([0-9a-fA-F]{40,40}) (.*)$/;
 			next if (!defined($1) || !defined($2));
Signature · 1 line
2.32.0.93.g670b81a890-goog
maintainer
#1 lore raw
Quoted 15 lines · Palmer Dabbelt

From: Palmer Dabbelt <[email protected]>

I have git-log setup to show signatures. I've recently noticed this breaking checkpatch error messages, which show something like

    ERROR: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'commit gpg: Signatu (":05 PM PDT")' #8:
    the module region by 3a02764c372c ("riscv: Ensure BPF_JIT_REGION_START

instead of something more helpful, like

    ERROR: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'commit 3a02764c372c ("riscv: Ensure BPF_JIT_REGION_START aligned with PMD size")' #8:
    the module region by 3a02764c372c ("riscv: Ensure BPF_JIT_REGION_START

Quoted 7 lines

which shows up with this patch. I'm not sure if these just started showing up for if I just noticed them or if they've been around forever.

I've only found it necessary to add --no-show-signature to the git-log invocation in git_commit_info(), but a cursory glance indicates that the other two invocations may suffer from similar problems so I've just added it everywhere.

Perhaps this should be in some standardized $git_log_options argument so that if there are more of these no-<foo> that need to be added, like for instance, --no-notes, it'd be easier to add everywhere.

scripts/checkpatch.pl

Quoted 1 line
scripts/checkpatch.pl +0 -0

[]

scripts/checkpatch.pl sub seed_camelcase_includes { · line 1103

Quoted 2 lines
scripts/checkpatch.pl +0 -0
@@ -1103,7 +1103,7 @@ sub seed_camelcase_includes {
  	$camelcase_seeded = 1;

somwhere above:

our $git_log_no_opts = '--no-show-signature --no-color"

scripts/checkpatch.pl sub seed_camelcase_includes { · line 1106

Quoted 4 lines
scripts/checkpatch.pl +1 -1
  	if (-e "$gitroot") {
-		my $git_last_include_commit = `${git_command} log --no-merges --pretty=format:"%h%n" -1 -- include`;
+		my $git_last_include_commit = `${git_command} log --no-show-signature --no-merges --pretty=format:"%h%n" -1 -- include`;

So this could be:

		my $git_last_include_commit = `${git_command} log $git_log_no_opts --no-merges --pretty=format:"%h%n" -1 -- include`;

scripts/checkpatch.pl sub git_commit_info { · line 1168

Quoted 10 lines
scripts/checkpatch.pl +0 -0
  		chomp $git_last_include_commit;
  		$camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit";
  	} else {
@@ -1165,7 +1165,7 @@ sub git_commit_info {


  return ($id, $desc) if ((which("git") eq "") || !(-e "$gitroot"));

scripts/checkpatch.pl +1 -1
-	my $output = `${git_command} log --no-color --format='%H %s' -1 $commit 2>&1`;
+	my $output = `${git_command} log --no-color --no-show-signature --format='%H %s' -1 $commit 2>&1`;
	my $output = `${git_command} log $git_log_no_opts --format='%H %s' -1 $commit 2>&1`;

etc...

scripts/checkpatch.pl if ($git) { · line 1218

Quoted 9 lines

  $output =~ s/^\s*//gm;
  my @lines = split("\n", $output);

scripts/checkpatch.pl +1 -1
@@ -1215,7 +1215,7 @@ if ($git) {
  		} else {
  			$git_range = "-1 $commit_expr";
  		}
-		my $lines = `${git_command} log --no-color --no-merges --pretty=format:'%H %s' $git_range`;
+		my $lines = `${git_command} log --no-show-signature --no-color --no-merges --pretty=format:'%H %s' $git_range`;
		my $lines = `${git_command} log $git_log_no_opts --no-merges --pretty=format:'%H %s' $git_range`;
Quoted 3 lines
scripts/checkpatch.pl +0 -0
  		foreach my $line (split(/\n/, $lines)) {
  			$line =~ /^([0-9a-fA-F]{40,40}) (.*)$/;
  			next if (!defined($1) || !defined($2));