coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] scripts: commit-msg: recognize Git cut_lines


From: Arsen Arsenović
Subject: [PATCH] scripts: commit-msg: recognize Git cut_lines
Date: Sun, 20 Nov 2022 12:25:12 +0100

This prevents spurious failures from happening when someone sets
commit.verbose or passes -v to commit.
---
Hi,

When working on my previous patch, I was running into commit-msg mistakenly
triggering on lines that are part of the diff that can be optionally added
to COMMIT_EDITMSG via commit.verbose (which I have set globally, to review
patches as I commit them).

This patch prevents that from happening.

For the source of the cut_line, see wt-status.c:23 (cut_line) in the Git
sources.

Have a good day.

 scripts/git-hooks/commit-msg | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/git-hooks/commit-msg b/scripts/git-hooks/commit-msg
index 8b06559..da094c9 100755
--- a/scripts/git-hooks/commit-msg
+++ b/scripts/git-hooks/commit-msg
@@ -120,6 +120,7 @@ sub check_msg($$)
   my $max_len = 72;
   foreach my $line (@line)
     {
+      last if $line =~ '.*-{24} >8 -{24}$';
       my $len = length $line;
       $max_len < $len && $line =~ /^[^#]/
         and return "line length ($len) greater than than max: $max_len";
-- 
2.38.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]