Re: [PATCH v2 1/1] merge-file: let conflict markers match end-of-line style of the context

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ramsay,

On Tue, 26 Jan 2016, Ramsay Jones wrote:

> On 26/01/16 08:54, Johannes Schindelin wrote:
> > Hi Ramsay,
> [snip]
> 
> >>
> >> But you are only testing 3/4 conflict markers end in CR/LF. :-D
> > 
> > The fact that ||| markers are present is the fault of previous test cases.
> > I tried to make a point of *not* relying on such a side effect (so as to
> > debug failures quicker by commenting out all previous test cases).
> > 
> > So the fact that I am testing only 3 of the 4 conflict markers is very
> > much by design.
> 
> I'm sorry, but I don't understand what you are trying to say here. :(

Typically, there are only 3 conflict markers:

<<<
diff 1
===
diff 2
>>>

However, you can tell merge-file to show also the original hunk, in this
case it was done by calling `git config merge.conflictstyle diff3` in an
earlier test, and this implementation detail seeps through to the current
test case.

Guess what, if you really only quickly want to run this last test (and
comment-out the previous ones), the conflict style is *not* diff3, and you
end up with the three conflict markers again.

> >>> Read: I am uncertain that I want to spend the additional lines on
> >>> testing more than actually necessary.
> >>
> >> If the here doc is too verbose for you, how about something like this
> >> (totally untested):
> >>
> >>     test $(tr "\015" Q <crlf.txt | grep "^[<=>|].*Q$" | wc -l) -eq 4
> >>
> >> instead?
> > 
> > Hmm. I do not see the benefit over grepping for `txtQ$` it's essentially
> > the same.
> 
> Well, as I said 'totally untested', but it _should_ be different. ;-)
> 
> The output from the 'tr "\015" Q <crlf.txt' subcommand should look
> something like:
> 
>     1Q
>     2Q
>     <<<<<<< crlf-diff1.txtQ
>     4Q
>     ||||||| crlf-orig.txtQ
>     3Q
>     =======Q
>     5Q
>     >>>>>>> crlf-diff2.txtQ
> 
> so that your 'grep "\\.txtQ$"' should select these lines:
> 
>     <<<<<<< crlf-diff1.txtQ
>     ||||||| crlf-orig.txtQ
>     >>>>>>> crlf-diff2.txtQ
> 
> whereas my 'grep "^[<=>|].*Q$"' should select these lines:
> 
>     <<<<<<< crlf-diff1.txtQ
>     ||||||| crlf-orig.txtQ
>     =======Q
>     >>>>>>> crlf-diff2.txtQ
> 
> (ie. select all 4 conflict markers).

True, I overlooked that the middle txtQ comes from the ||| line that I
actually did *not* want to test for (see above).

Will fix.

Ciao,
Dscho
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]