# Re: \[PATCH v2 1/2\] xdiff: implement a zealous diff3, or "zdiff3"

- From: Phillip Wood \<hidden\>
- Date: 2021-09-24 10:16:34 
- List: git
- Page: https://ratatoskr.run/git/2021/09/7903500
- Thread: https://ratatoskr.run/git/2021/06/7891996/t.md

```text
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/

```
