"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: diff.git: Fix ed script output
To:
Tom Jones <thj@freebsd.org>
Cc:
gameoftrees@openbsd.org
Date:
Tue, 30 Aug 2022 17:35:31 +0200

Download raw body.

Thread
On Tue, Aug 30, 2022 at 04:28:07PM +0100, Tom Jones wrote:
> On Tue, Aug 30, 2022 at 05:19:29PM +0200, Stefan Sperling wrote:
> > On Tue, Aug 30, 2022 at 02:47:58PM +0100, Tom Jones wrote:
> > > Prior to this change ed script output was in the wrong order, i.e. in
> > > the order diff_result provides and changes where missing added or
> > > changed lines. ed edits need to be in reverse order to keep the edited
> > > file in sync 
> > 
> > As it is, this patch breaks merging on Got, which relies on the
> > existing output. The existing output is based on the 'ed-style'
> > script which Caldera diff3(1) generates internally. As you've
> > discovered this seems to not match traditional diff(1) ed output,
> > which is unfortunate, and I was unaware of this when I added the
> > ed output module for the purpose of supporting Got's merging code.
> > 
> > So we will need both variants. Should we add a flag?
> > Or would providing two different ed-output modules be better?
> 
> Does the got version include the changed/added lines? The diff.git one
> didn't, which made me think it didn't work.
> 
> In addition to ed script diff also has forward ed (-f) with mangled commands
> and reverse ed (-n).
> 
>      -f --forward-ed
>              Identical output to that of the -e flag, but in reverse order.
>              It cannot be digested by ed(1).
> 
>      -n      Produces a script similar to that of -e, but in the opposite
>              order and with a count of changed lines on each insert or delete
>              command.  This is the form used by rcsdiff.
> 
> Is one of these the input that diff3 requires?

I am not sure which it is.
I just worked towards what the diff3 code expects, and tested my changes
by running the Got test suite. The diff3 code used by Got is the same as
used by OpenRCS and OpenCVS. FreeBSD has this code in usr.bin/diff3/diff3.c.