From: Phillip Wood Date: Fri, 24 Sep 2021 10:16:23 GMT Subject: Re: [PATCH v2 1/2] xdiff: implement a zealous diff3, or "zdiff3" Message-ID: <3f5e1569-4ccd-8494-ea18-1e00bdc73017@gmail.com> In-Reply-To: Hi Elijah On 18/09/2021 23:04, Elijah Newren wrote: > Hi Phillip, > [...] >> I do wonder (though a brief try failed to trigger it) if there are cases >> where the diff algorithm does something "clever" which means it does not >> treat a common prefix or suffix as unchanged (see d2f82950a9 >> ("Re(-re)*fix trim_common_tail()", 2007-12-20) for a related issue). We >> could just trim the common prefix and suffix from the two sides >> ourselves using xdl_recmatch(). > > You seem to understand the xdl stuff much better than I. I'm not sure > how xdl_recmatch() would be called or where. Would you like to take > over the patches? I could do if you really want but I wont have time to do anything for at least a couple of weeks (I really need to get on top of my current series before starting anything new). I outlined the rough idea in [1]. tldr; instead of diffing the two sides of the conflict just walk the start and the end of the two sides until we find a line that does not match. Best Wishes Phillip [1] https://lore.kernel.org/git/f76c79d6-f280-3011-d88d-6de146977626@gmail.com/