Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752382AbdFGSkc (ORCPT ); Wed, 7 Jun 2017 14:40:32 -0400 Received: from mout.gmx.net ([212.227.15.18]:52584 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751955AbdFGSk3 (ORCPT ); Wed, 7 Jun 2017 14:40:29 -0400 From: Heinrich Schuchardt To: Andy Whitcroft , Joe Perches Cc: linux-kernel@vger.kernel.org, Heinrich Schuchardt Subject: [PATCH 1/1 v2] checkpatch: remove false warning for commit reference Date: Wed, 7 Jun 2017 20:40:08 +0200 Message-Id: <20170607184008.5869-1-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <1477255021.3561.9.camel@perches.com> References: <1477255021.3561.9.camel@perches.com> X-Provags-ID: V03:K0:nungGMu6IBgho3exouDFVFAzKXgggNgmJU+IQdsN9il2vtQfMx3 qAYX+/oK9a319nmlFWghXDhGwL5GLhbw5/58f7H0+AH4HS3sBwFnd4vAoQtGwFF+Bu6oX+r u6YP13MM+IGgkEZ+5X8T/mmCQx6P+KFsRMg6Xr5XmcGe4TN2la7PnJJgpljDBxzQD3jRC1v AmWDOrs6uUyT/YkrNTbSw== X-UI-Out-Filterresults: notjunk:1;V01:K0:akU+QJEYTws=:eBOo4JB3uxSBJ5SITfb7cQ tZ6jaUgGSkvf8tNb2Om1s7EBVrLm1jLifCspHQY6STKaV4l69XnoCseV6FaPm/E7W2TY6HMZ5 7dvW4xQmBjYxKNoXMQ78mDfRZgXWaxXVABDAKHnEUbpgSiAyeaPILRdKwJPF4C9rDhQ6HovQl HllfO1EzFk7OOwho9EXHWTcjzbzpB8q/IX1maUNu4DS2wi0y+3eYAOcyslJaE/AP3z2Rv3Q7B uY/hsgeY0fq28EqGFgMULbUlL0tqRXTSsk5MtRw/180kccJE5HEZdURpeOrfR887oJTs+DX25 k7iDfSFnIsK/grTdUscz+ceu+CSEPPK6LMZBWBK5Q+ZoGeFmpoxwGLXKACxvtoZXVwppd2WVC UXnjnc+sFTRskBdcZF9HvXWxxpe8gXMGAqpaOtq+IeJS/HmNrM1CV/R3zd720/AN7JQxH1JBD JO7mtFqXov5HZZ5oHkyFQZrf6Bby30rPwHFrDWwqeGGAmZDfMRS5x5s85QHBNf1dxXUWZahF1 CsMqihNteBtQa9YhhI72uR6N0jpIBNvVzHpxZbpeRVvSXsHlGCh5lG16Xw+2XrspQ2q1MO9oo Sh6PKhEohb11ylKWr18YW0aaDaI4VstsZU+4gt3kh9BfekZ5suhVGTwAyMO5/JYJHAGFAsyYv KLGqnYCY7KnJ0fUhXeXcu+FQby9Due6C/nGZMIph+XeR75pZvYxTwBrhYJIG05l0vp/AjhJ17 W9dwTi52CG/0ZjVmBSSye2TNKs85dHbzlT84vXFy0ALXHpSKTYGlVtXL104= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1572 Lines: 44 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 Signed-off-by: Heinrich Schuchardt --- 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> (\"\")' - ie: '${init_char}ommit $id (\"$description\")'\n" . $herecurr); } -- 2.11.0