From: Tom Jones Subject: Re: diff.git: Fix ed script output To: gameoftrees@openbsd.org Date: Tue, 30 Aug 2022 16:28:07 +0100 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? - Tom