Hello,

the contrib script "detect-merge-conflicts.sh" [1] uses a grep command which 
also finds false positive merge conflict markers: it finds single lines of 
"=======" and the pre-commit will fail.

For example I wanted to add a readme file that contains the following two lines:
Install
=======

Of course committing failed.

The correct solution would be to use sed and search for real blocks of merge 
conflict marker:
SUSPICIOUS=$($SVNLOOK diff -t "$TXN" "$REPOS" | sed -n -e '/^+<<<<<<< 
\..*$/,/^+>>>>>>> \..*$/ { /^+=======$/p ; //q  }' | wc -l)

This sed command finds blocks enclosed with new "<<<<<< ." and ">>>>>>>." and 
checks if this block contains a new line with "=======". If found it prints out 
that line and quits sed.

Kind regards
Matthias "Maddes" Bücher

P.S.:
I'm not subscribed and would appreciate being explicitly Cc:ed in any 
responses. Thanks.

[1] 
http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/detect-merge-conflicts.sh

Reply via email to