3 # A pre-commit hook to detect changes that look like forgotten
4 # conflict markers. If any additions starting with '>>>>>>>',
5 # '=======' or '<<<<<<<' are found, the commit is aborted with a nice
11 # $LastChangedRevision$
16 SVNLOOK
=/usr
/bin
/svnlook
19 if [ -z "$REPOS" -o -z "$TXN" ]; then
20 echo "Syntax: $0 path_to_repos txn_id" >&2
24 # We scan through the transaction diff, looking for things that look
25 # like conflict markers. If we find one, we abort the commit.
26 SUSPICIOUS
=$
($SVNLOOK diff -t "$TXN" "$REPOS" |
grep -E '^\+(<{7} \.|={7}$|>{7} \.)' |
wc -l)
28 if [ $SUSPICIOUS -ne 0 ]; then
29 echo "Some parts of your commit look suspiciously like merge" >&2
30 echo "conflict markers. Please double-check your diff and try" >&2
31 echo "committing again." >&2
35 # No conflict markers detected, let it fly!