[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [bug] detect-merge-conflicts.sh reports false positive merge conflict markers

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Wed, 20 Feb 2013 16:47:06 +0200

Thanks Gavin. Matthias: how portable are the sed constructs you used?

They seem to be invalid on BSD sed:
% printf 'foo\nbar\nbaz\n' | sed -ne '/foo/,/baz/ { /bar/p }'
sed: 1: "/foo/,/baz/ { /bar/p }
": extra characters at the end of p command

I don't mind improving the detection but I'd like to keep the script
portable (and the check cheap, if possible, since 'diff' output can be
large).

Gavin Baumanis wrote on Wed, Feb 20, 2013 at 09:10:48 -0500:
> Ping.
> This Patch submission has received no comments.
>
>
>
> > -----Original Message-----
> > From: Matthias Buecher / Germany [mailto:mail_at_maddes.net]
> > Sent: Saturday, 2 February 2013 15:20
> > To: dev_at_subversion.apache.org
> > Subject: [bug] detect-merge-conflicts.sh reports false positive merge conflict
> > markers
> >
> > 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
>
Received on 2013-02-20 15:47:45 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.