[darcs-devel] [issue2160] Darcs whatsnew incorrectly reports line number for change that adds blank line to EOF

Ben Franksen bugs at darcs.net
Sun Aug 13 12:54:09 UTC 2017


Ben Franksen <ben.franksen at online.de> added the comment:

This is an interesting bug. It is easy to fix: just add an extra case
when both files end with a newline, then remove both newlines before
splitting into lines. What is interesting is that this make an ancient
test fail, namely tests/merging_newlines.sh. As it turns out, this was
once a failing test, but David changed it (back in 2008) to one that
doesn't fail.The test tries to merge (push) appending a non-empty line
with appending an empty line.

Indeed, if one accepts that adding a newline to a file that contains a
single line of text is a change on *line 3*, then there is no conflict
with another change that adds some text to line 2.

However, reporting the addition of an empty line to a one-line file at
line 3 is highly un-intuitive, even though one could argue that it is
not incorrect in a strict sense, since one may have a different view of
how things like 'line' and 'appending a line' are defined. In any case,
darcs annotate assumes the intuitive view and would have to be changed
to conform to the current (un-intuitive) behavior of darcs.

The upshot is that IMO this is indeed a bug and
tests/merging_newlines.sh should fail (i.e. report a conflict).

I am going to send the fix for this issue. As stipulated by owst, this
indeed also fixes issue2154. Of course, already recorded patches are not
affected, so we will still see the 'unknown' annotations for old repos
e.g. src/Darcs/Util/Email.hs).

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/issue2160>
__________________________________


More information about the darcs-devel mailing list