monotone-devel
[Top][All Lists]
Advanced

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

Re: [Monotone-devel] BUG: "mtn diff" vs. "diff" with respect to not exis


From: Ralf S. Engelschall
Subject: Re: [Monotone-devel] BUG: "mtn diff" vs. "diff" with respect to not existing trailing newline on last line
Date: Thu, 28 Feb 2008 08:07:40 +0100
User-agent: Mutt/1.5.17 OpenPKG/CURRENT (2007-11-01)

On Wed, Feb 27, 2008, Thomas Keller wrote:

> Ralf S. Engelschall schrieb:
>> | +++ test2.txt   2008-02-27 19:26:28 +0100
>> | @@ -1,3 +1,4 @@
>> |  foo
>> |  bar
>> | -quux
>> | \ No newline at end of file
>> | +quux
>> | +baz
>
> Out of interest, why doesn't diff(1)'s output look like this?
>
> | +++ test2.txt   2008-02-27 19:26:28 +0100
> | @@ -1,3 +1,4 @@
> |  foo
> |  bar
> |  quux
> | +baz
> | \ No newline at end of file
>
> Because it seems to be a bit weird to me at least that the quux line which
> was there before was removed and then re-added just because it had no
> following newline in the first case...

Well, your output means to not touch the "quux" line at all but to not
append a trailing newline to the "baz" line. That's not what my change
actually did: I changed the "quux" line (because I added the newline)
and I also added a "baz" line including a trailing newline. So, the
output of diff(1) is really correctly matching my change.

Your suggested output diff is corresponding to this change:

$ (echo "foo"; echo "bar"; echo "quux") >test2.txt
$ cp test2.txt test2.txt.orig
$ (echo -n "baz") >>test2.txt
$ diff -u3 test2.txt.orig test2.txt.orig

But my change actually is (not the position of the "-n" option to echo(1)):

$ (echo "foo"; echo "bar"; echo -n "quux") >test2.txt
$ cp test2.txt test2.txt.orig
$ (echo "baz") >>test2.txt
$ diff -u3 test2.txt.orig test2.txt.orig

> In any case, an interesting finding. And since the diff format is probably
> not about to be changed in this case, we just need to comply anyways...

Yes, of course.
                                       Ralf S. Engelschall
                                       address@hidden
                                       www.engelschall.com





reply via email to

[Prev in Thread] Current Thread [Next in Thread]