@matheusbsbs / matheus-bagliano / commits / 61c2bcbd11
Fork 0

pre-commit hook: complain about conflict markers.

Several <<< or === or >>> characters at the beginning of a line is very likely to be leftover conflict markers from a failed automerge the user resolved incorrectly, so detect them. As usual, this can be defeated with "git commit --no-verify" if you really do want to have those files, just like changes that introduce trailing whitespaces. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Apr 19, 2006 at 14:58 UTC 61c2bcbd11e3b66a328b3850c01592e5dc1c67bb
1 file changed +3
templates/hooks--pre-commit
+3
@@ -61,6 +61,9 @@ perl -e '
61 if (/^\s* /) {
62 bad_line("indent SP followed by a TAB", $_);
63 }
64 + if (/^(?:[<>=]){7}/) {
65 + bad_line("unresolved merge conflict", $_);
66 + }
67 }
68 }
69 exit($found_bad);