Re: [PATCH] checkpatch.pl: Relax commit ID check to allow more than 12 chars

From: Jonathan Neuschäfer
Date: Tue Jan 31 2023 - 16:00:30 EST


On Sun, Jan 29, 2023 at 09:52:38AM -0800, Joe Perches wrote:
> On Sun, 2023-01-29 at 13:34 +0100, Jonathan Neuschäfer wrote:
> > By now, `git log --pretty=%h` (on my copy of linux.git) prints commit
> > hashes with 13 digits, because of the number of objects.
> >
> > Relax the rule in checkpatch.pl to allow a few more digits (up to 16).
>
> NAK without updating the process docs first.

Good point, I'll do that.

Thanks,
Jonathan

>
> Documentation/process/submitting-patches.rst-If your patch fixes a bug in a specific commit, e.g. you found an issue using
> Documentation/process/submitting-patches.rst:``git bisect``, please use the 'Fixes:' tag with the first 12 characters of
> Documentation/process/submitting-patches.rst-the SHA-1 ID, and the one line summary. Do not split the tag across multiple
> Documentation/process/submitting-patches.rst-lines, tags are exempt from the "wrap at 75 columns" rule in order to simplify
> Documentation/process/submitting-patches.rst-parsing scripts. For example::
> Documentation/process/submitting-patches.rst-
> Documentation/process/submitting-patches.rst- Fixes: 54a4f0239f2e ("KVM: MMU: make kvm_mmu_zap_page() return the number of pages it actually fr>
> Documentation/process/submitting-patches.rst-
> Documentation/process/submitting-patches.rst-The following ``git config`` settings can be used to add a pretty format for
> Documentation/process/submitting-patches.rst-outputting the above style in the ``git log`` or ``git show`` commands::
> Documentation/process/submitting-patches.rst-
> Documentation/process/submitting-patches.rst- [core]
> Documentation/process/submitting-patches.rst: abbrev = 12
> Documentation/process/submitting-patches.rst- [pretty]
> Documentation/process/submitting-patches.rst- fixes = Fixes: %h (\"%s\")
>
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
> > @@ -3177,7 +3177,7 @@ sub process {
> > $tag_case = 0 if $tag eq "Fixes:";
> > $tag_space = 0 if ($line =~ /^fixes:? [0-9a-f]{5,} ($balanced_parens)/i);
> >
> > - $id_length = 0 if ($orig_commit =~ /^[0-9a-f]{12}$/i);
> > + $id_length = 0 if ($orig_commit =~ /^[0-9a-f]{12,16}$/i);
> > $id_case = 0 if ($orig_commit !~ /[A-F]/);
> >
> > # Always strip leading/trailing parens then double quotes if existing
> > @@ -3194,7 +3194,7 @@ sub process {
> > if ($ctitle ne $title || $tag_case || $tag_space ||
> > $id_length || $id_case || !$title_has_quotes) {
> > if (WARN("BAD_FIXES_TAG",
> > - "Please use correct Fixes: style 'Fixes: <12 chars of sha1> (\"<title line>\")' - ie: 'Fixes: $cid (\"$ctitle\")'\n" . $herecurr) &&
> > + "Please use correct Fixes: style 'Fixes: <12-16 chars of sha1> (\"<title line>\")' - ie: 'Fixes: $cid (\"$ctitle\")'\n" . $herecurr) &&
> > $fix) {
> > $fixed[$fixlinenr] = "Fixes: $cid (\"$ctitle\")";
> > }
> > --
> > 2.39.0
> >
>

Attachment: signature.asc
Description: PGP signature