Skip to contentSkip to conversation

Make default pre-commit hook less noisy

PATCH In review Jean-Luc Herren 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make default pre-commit hook less noisy

This hook thought to have found a conflict marker any time it saw a 7-character combination of any of the characters '<>=' at the beginning of a line, whereas it should only look for the *same* character to appear repeatedly.

Also, restrict it to match exactly 7 times, to avoid matching the underlining with '='-characters often used in documentation.

---
As far as I know, this will still properly match all conflict markers, even those by cvs or svn.

 templates/hooks--pre-commit |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
templates/hooks--pre-commit +1 -1
index 7092bae..b25dce6 100644
@@ -61,7 +61,7 @@ perl -e '
 	    if (/^\s* \t/) {
 		bad_line("indent SP followed by a TAB", $_);
 	    }
-	    if (/^(?:[<>=]){7}/) {
+	    if (/^([<>])\1{6} |^={7}$/) {
 		bad_line("unresolved merge conflict", $_);
 	    }
 	}
Signature · 1 line
1.5.3.8
#1 lore raw
Quoted 4 lines · Jean-Luc Herren

This hook thought to have found a conflict marker any time it saw a 7-character combination of any of the characters '<>=' at the beginning of a line, whereas it should only look for the *same* character to appear repeatedly.

I think itt looks good. Thanks.