linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Ayush <ayush@disroot.org>, apw@canonical.com
Cc: linux-kernel-mentees@lists.linuxfoundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [Linux-kernel-mentees] [PATCH] checkpatch: GIT_COMMIT_ID: handle commit messages with multiple quotes
Date: Mon, 07 Sep 2020 13:50:13 -0700	[thread overview]
Message-ID: <beed63208cc412f122fe273602675801add08ede.camel@perches.com> (raw)
In-Reply-To: <20200907151417.44453-1-ayush@disroot.org>

On Mon, 2020-09-07 at 20:44 +0530, Ayush wrote:
> Commits which mentioned/referenced "revert commits" in their description will
> get error even if they follow the proper syntax.

I think all your examples are broken.

I think all should start with revert
i.e.: Reverts commit <SHA-1> ("description...")

> for reference:
> commit e8a170ff9a35 ("drm/amdgpu: enable -msse2 for GCC 7.1+ users")
> 
> This patch checks for quotes inside the commit message and adds it
> to $orig_desc.
> 
> Earlier, the script just won't update in case of such commit message.
> I modified old condition and added new conditions to check possible
> patterns.
> 
> Following patters are solved (commit taken as example):
> - commit 193392ed9f69 ("Revert "drm/amd/display: add -msse2 to prevent Clang from emitting libcalls to undefined SW FP routines"")
> 
> - commit 193392ed9f69 ("Revert
> "drm/amd/display: add -msse2 to prevent Clang from emitting libcalls to undefined SW FP routines"")
> 
> - commit 193392ed9f69 ("Revert "drm/amd/display:
> add -msse2 to prevent Clang from emitting libcalls to undefined SW FP routines"")
> 
> - commit 193392ed9f69
> ("Revert "drm/amd/display: add -msse2 to prevent Clang from emitting libcalls to undefined SW FP routines"")
> 
> Signed-off-by: Ayush <ayush@disroot.org>
> ---
>  scripts/checkpatch.pl | 33 ++++++++++++++++++++++++++-------
>  1 file changed, 26 insertions(+), 7 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 149518d2a6a7..e90e13b013d3 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2862,23 +2862,42 @@ sub process {
>  				$orig_desc = $1;
>  				$hasparens = 1;
>  			} elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i &&
> -				 defined $rawlines[$linenr] &&
> -				 $rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) {
> +				 defined $rawlines[$linenr]) {
> +				if ($rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) {
> +					$orig_desc = $1;
> +					$hasparens = 1;
> +				} elsif ($rawlines[$linenr] =~ /^\s*\("([^"]+"[^"]+[^"]")"\)/) {
> +					$orig_desc = $1;
> +					$hasparens = 1;
> +				}
> +			} elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i &&
> +				 defined $rawlines[$linenr]) {
> +				$line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i;
>  				$orig_desc = $1;
> +				if($rawlines[$linenr] =~ /^\s*[^"]+"\)/) {
> +					$rawlines[$linenr] =~ /^\s*([^"]+)"\)/;
> +					$orig_desc .= " " . $1;
>  				$hasparens = 1;
> -			} elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i &&
> +				} elsif ($rawlines[$linenr] =~ /^\s*"[^"]+""\)/) {
> +					$rawlines[$linenr] =~ /^\s*("[^"]+")"\)/;
> +					$orig_desc .= " " . $1;
> +					$hasparens = 1;
> +				}
> +			} elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+"[^"]+[^"]")"\)/i) {
> +				$orig_desc = $1;
> +			    $hasparens = 1;
> +			} elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+"[^"]+$/i &&
>  				 defined $rawlines[$linenr] &&
> -				 $rawlines[$linenr] =~ /^\s*[^"]+"\)/) {
> -				$line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i;
> +				 $rawlines[$linenr] =~ /^\s*[^"]+""\)/) {
> +				$line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+"[^"]+)$/i;
>  				$orig_desc = $1;
> -				$rawlines[$linenr] =~ /^\s*([^"]+)"\)/;
> +				$rawlines[$linenr] =~ /^\s*([^"]+")"\)/;
>  				$orig_desc .= " " . $1;
>  				$hasparens = 1;
>  			}
>  
>  			($id, $description) = git_commit_info($orig_commit,
>  							      $id, $orig_desc);
> 
>  			if (defined($id) &&
>  			   ($short || $long || $space || $case || ($orig_desc ne $description) || !$hasparens)) {
>  				ERROR("GIT_COMMIT_ID",

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

  reply	other threads:[~2020-09-07 21:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-07 15:14 [Linux-kernel-mentees] [PATCH] checkpatch: GIT_COMMIT_ID: handle commit messages with multiple quotes Ayush
2020-09-07 20:50 ` Joe Perches [this message]
2020-09-08  8:32 ` Ayush
2020-09-09 10:06   ` Lukas Bulwahn
2020-09-09 10:31   ` Ayush
2020-09-09 11:32     ` Lukas Bulwahn
2020-09-09 12:02       ` Joe Perches
2020-09-09 13:10         ` Lukas Bulwahn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=beed63208cc412f122fe273602675801add08ede.camel@perches.com \
    --to=joe@perches.com \
    --cc=apw@canonical.com \
    --cc=ayush@disroot.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).