Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1660093 > unrolled thread

[PATCH 1/1 v2] checkpatch: remove false warning for commit reference

Started byHeinrich Schuchardt <xypron.glpk@gmx.de>
First post2017-06-07 20:50 +0200
Last post2017-06-07 21:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/1 v2] checkpatch: remove false warning for commit reference Heinrich Schuchardt <xypron.glpk@gmx.de> - 2017-06-07 20:50 +0200
    Re: [PATCH 1/1 v2] checkpatch: remove false warning for commit  reference Joe Perches <joe@perches.com> - 2017-06-07 21:00 +0200

#1660093 — [PATCH 1/1 v2] checkpatch: remove false warning for commit reference

FromHeinrich Schuchardt <xypron.glpk@gmx.de>
Date2017-06-07 20:50 +0200
Subject[PATCH 1/1 v2] checkpatch: remove false warning for commit reference
Message-ID<tPObM-1TW-17@gated-at.bofh.it>
Checkpatch warns of an incorrect commit reference style
for any hexadecimal number of 12 digits and more.

Numbers of 12 digits are not necessarily commit ids.

For an example provoking the problem see
https://patchwork.kernel.org/patch/9170897/

Checkpatch should only warn if the number refers to an
existing commit.

Cc: Joe Perches <joe@perches.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
v2:
	changed formatting according to suggestions by Joe Perches
---
 scripts/checkpatch.pl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4b9569fa931b..3895978c5bbd 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -866,6 +866,7 @@ sub git_commit_info {
 #		    echo "commit $(cut -c 1-12,41-)"
 #		done
 	} elsif ($lines[0] =~ /^fatal: ambiguous argument '$commit': unknown revision or path not in the working tree\./) {
+		$id = undef;
 	} else {
 		$id = substr($lines[0], 0, 12);
 		$desc = substr($lines[0], 41);
@@ -2605,7 +2606,8 @@ sub process {
 			($id, $description) = git_commit_info($orig_commit,
 							      $id, $orig_desc);
 
-			if ($short || $long || $space || $case || ($orig_desc ne $description) || !$hasparens) {
+			if (defined($id) &&
+			   ($short || $long || $space || $case || ($orig_desc ne $description) || !$hasparens)) {
 				ERROR("GIT_COMMIT_ID",
 				      "Please use git commit description style 'commit <12+ chars of sha1> (\"<title line>\")' - ie: '${init_char}ommit $id (\"$description\")'\n" . $herecurr);
 			}
-- 
2.11.0

[toc] | [next] | [standalone]


#1660111 — Re: [PATCH 1/1 v2] checkpatch: remove false warning for commit reference

FromJoe Perches <joe@perches.com>
Date2017-06-07 21:00 +0200
SubjectRe: [PATCH 1/1 v2] checkpatch: remove false warning for commit reference
Message-ID<tPOlr-1X8-13@gated-at.bofh.it>
In reply to#1660093
On Wed, 2017-06-07 at 20:40 +0200, Heinrich Schuchardt wrote:
> Checkpatch warns of an incorrect commit reference style
> for any hexadecimal number of 12 digits and more.
> 
> Numbers of 12 digits are not necessarily commit ids.
> 
> For an example provoking the problem see
> https://patchwork.kernel.org/patch/9170897/
> 
> Checkpatch should only warn if the number refers to an
> existing commit.
> 
> Cc: Joe Perches <joe@perches.com>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> v2:
> 	changed formatting according to suggestions by Joe Perches

Wow, the original patch was 8+ months ago.  Anyway:

Acked-by: Joe Perches <joe@perches.com>

> ---
>  scripts/checkpatch.pl | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 4b9569fa931b..3895978c5bbd 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -866,6 +866,7 @@ sub git_commit_info {
>  #		    echo "commit $(cut -c 1-12,41-)"
>  #		done
>  	} elsif ($lines[0] =~ /^fatal: ambiguous argument '$commit': unknown revision or path not in the working tree\./) {
> +		$id = undef;
>  	} else {
>  		$id = substr($lines[0], 0, 12);
>  		$desc = substr($lines[0], 41);
> @@ -2605,7 +2606,8 @@ sub process {
>  			($id, $description) = git_commit_info($orig_commit,
>  							      $id, $orig_desc);
>  
> -			if ($short || $long || $space || $case || ($orig_desc ne $description) || !$hasparens) {
> +			if (defined($id) &&
> +			   ($short || $long || $space || $case || ($orig_desc ne $description) || !$hasparens)) {
>  				ERROR("GIT_COMMIT_ID",
>  				      "Please use git commit description style 'commit <12+ chars of sha1> (\"<title line>\")' - ie: '${init_char}ommit $id (\"$description\")'\n" . $herecurr);
>  			}

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web