mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-04-13 09:59:31 +00:00
Align git commit ID abbreviation guidelines and checks
The guidelines for git commit ID abbreviation are inconsistent: some
places state to use 12 characters exactly, while other places recommend
12 characters or more. The same issue is present in the checkpatch.pl
script.
E.g. Documentation/dev-tools/checkpatch.rst says:
**GIT_COMMIT_ID**
The proper way to reference a commit id is:
commit <12+ chars of sha1> ("<title line>")
However, scripts/checkpatch.pl has two different checks: one warning
check accepting 12 characters exactly:
# Check Fixes: styles is correct
Please use correct Fixes: style 'Fixes: <12 chars of sha1> (\"<title line>\")'
and a second error check accepting 12-40 characters:
# Check for git id commit length and improperly formed commit descriptions
# A correctly formed commit description is:
# commit <SHA-1 hash length 12+ chars> ("Complete commit subject")
Please use git commit description style 'commit <12+ chars of sha1>
Hence patches containing commit IDs with more than 12 characters are
flagged by checkpatch, and sometimes rejected by maintainers or
reviewers. This is becoming more important with the growth of the
repository, as git may decide to use more characters in case of local
conflicts.
Fix this by settling on at least 12 characters, in both the
documentation and in the checkpatch.pl script.
Fixes: bd17e036b4
("checkpatch: warn for non-standard fixes tag style")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/1c244040bf6ce304656e31036e5178b4b9dfb719.1733421037.git.geert+renesas@glider.be
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
This commit is contained in:
parent
3f997cbf67
commit
6356f18f09
3 changed files with 7 additions and 7 deletions
|
@ -270,7 +270,7 @@ Ordering of commit tags
|
||||||
To have a uniform view of the commit tags, the tip maintainers use the
|
To have a uniform view of the commit tags, the tip maintainers use the
|
||||||
following tag ordering scheme:
|
following tag ordering scheme:
|
||||||
|
|
||||||
- Fixes: 12char-SHA1 ("sub/sys: Original subject line")
|
- Fixes: 12+char-SHA1 ("sub/sys: Original subject line")
|
||||||
|
|
||||||
A Fixes tag should be added even for changes which do not need to be
|
A Fixes tag should be added even for changes which do not need to be
|
||||||
backported to stable kernels, i.e. when addressing a recently introduced
|
backported to stable kernels, i.e. when addressing a recently introduced
|
||||||
|
|
|
@ -143,10 +143,10 @@ also track such tags and take certain actions. Private bug trackers and
|
||||||
invalid URLs are forbidden.
|
invalid URLs are forbidden.
|
||||||
|
|
||||||
If your patch fixes a bug in a specific commit, e.g. you found an issue using
|
If your patch fixes a bug in a specific commit, e.g. you found an issue using
|
||||||
``git bisect``, please use the 'Fixes:' tag with the first 12 characters of
|
``git bisect``, please use the 'Fixes:' tag with at least the first 12
|
||||||
the SHA-1 ID, and the one line summary. Do not split the tag across multiple
|
characters of the SHA-1 ID, and the one line summary. Do not split the tag
|
||||||
lines, tags are exempt from the "wrap at 75 columns" rule in order to simplify
|
across multiple lines, tags are exempt from the "wrap at 75 columns" rule in
|
||||||
parsing scripts. For example::
|
order to simplify parsing scripts. For example::
|
||||||
|
|
||||||
Fixes: 54a4f0239f2e ("KVM: MMU: make kvm_mmu_zap_page() return the number of pages it actually freed")
|
Fixes: 54a4f0239f2e ("KVM: MMU: make kvm_mmu_zap_page() return the number of pages it actually freed")
|
||||||
|
|
||||||
|
|
|
@ -3230,7 +3230,7 @@ sub process {
|
||||||
my $tag_case = not ($tag eq "Fixes:");
|
my $tag_case = not ($tag eq "Fixes:");
|
||||||
my $tag_space = not ($line =~ /^fixes:? [0-9a-f]{5,40} ($balanced_parens)/i);
|
my $tag_space = not ($line =~ /^fixes:? [0-9a-f]{5,40} ($balanced_parens)/i);
|
||||||
|
|
||||||
my $id_length = not ($orig_commit =~ /^[0-9a-f]{12}$/i);
|
my $id_length = not ($orig_commit =~ /^[0-9a-f]{12,40}$/i);
|
||||||
my $id_case = not ($orig_commit !~ /[A-F]/);
|
my $id_case = not ($orig_commit !~ /[A-F]/);
|
||||||
|
|
||||||
my $id = "0123456789ab";
|
my $id = "0123456789ab";
|
||||||
|
@ -3240,7 +3240,7 @@ sub process {
|
||||||
if ($ctitle ne $title || $tag_case || $tag_space ||
|
if ($ctitle ne $title || $tag_case || $tag_space ||
|
||||||
$id_length || $id_case || !$title_has_quotes) {
|
$id_length || $id_case || !$title_has_quotes) {
|
||||||
if (WARN("BAD_FIXES_TAG",
|
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+ chars of sha1> (\"<title line>\")' - ie: 'Fixes: $cid (\"$ctitle\")'\n" . $herecurr) &&
|
||||||
$fix) {
|
$fix) {
|
||||||
$fixed[$fixlinenr] = "Fixes: $cid (\"$ctitle\")";
|
$fixed[$fixlinenr] = "Fixes: $cid (\"$ctitle\")";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue