git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] blame: make diff algorithm configurable

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Oct 30, 2025, 10:47 UTC
Message-ID
<fa9c953b-a03f-44ab-962e-3eb4ee335b5b@gmail.com>
In-Reply-To
<33d44dc6-36b3-4736-b3ed-96861a3c4003@delpeuch.eu>
Hi Antonin
On 30/10/2025 09:22, Antonin Delpeuch wrote:
Show 25 quoted lines
> On 29/10/2025 11:16, Phillip Wood wrote:
>> Unfortunately XDF_DIFF_ALGORITHM_MASK does not include 
>> XDF_NEED_MINIMAL so if the user has a config file that looks like
>>
>>     [diff]
>>         algorithm = minimal
>>         algorithm = myers
>>
>> We'll parse it as "minimal" rather than "myers"
>>
>> As we need to reset the diff algorithm in a number of places I think 
>> it would be best to define a macro
>>
>>         #define CLEAR_DIFF_ALGORITHM(flags) \
>>         flags &= ~(XDF_DIFF_ALGORITHM_MASK | XDF_NEED_MINIMAL)
> 
> Ouch, good catch! This problem is affecting other places as well.
> 
> I'm wondering if we couldn't even add XDF_NEED_MINIMAL to 
> XDF_DIFF_ALGORITHM_MASK. I've reviewed all the places where 
> XDF_DIFF_ALGORITHM_MASK is used, and it seems that in all cases it would 
> either preserve the existing behaviour (potentially allowing us to 
> remove an accompanying "DIFF_XDL_CLR(opts, NEED_MINIMAL);" macro which 
> becomes redundant), or in some other cases it would fix a similar issue 
> (for instance, in merge-file.c).

Thanks for taking the time to look at the other uses of XDF_DIFF_ALGORITHM_MASK. I think adding XDF_NEED_MINIMAL to XDF_DIFF_ALGORITHM_MASK is a good idea as I think we always treat "minimal" as another diff algorithm, rather than a variant of "myers" which is how it is implemented in xdiff.

> Is your suggestion to introduce a new macro motivated by stability 
> concerns? I'm aware that xdiff is used in other code bases as a library, 
> so I guess changing XDF_DIFF_ALGORITHM_MASK can indeed be seen as a 
> breaking change.

While it is a breaking change, tweaking XDF_DIFF_ALGORITHM_MASK seems like a better idea to me. I wondered about it yesterday but worried it would end up being too much work to review all the existing uses.

Thanks
Phillip
> Antonin
> 
Previous: Antonin DelpeuchNext: Antonin Delpeuch via GitGitGadget
Message 13 of 32 in “blame: make diff algorithm configurable”
  1. blame: make diff algorithm configurableAntonin Delpeuch via GitGitGadget, Oct 20, 2025
  2. Junio C HamanoOct 20, 2025
  3. Antonin DelpeuchOct 22, 2025
  4. Junio C HamanoOct 22, 2025
  5. Phillip WoodOct 23, 2025
  6. blame: make diff algorithm configurableAntonin Delpeuch via GitGitGadget, Oct 28, 2025
  7. Junio C HamanoOct 28, 2025
  8. Antonin DelpeuchOct 28, 2025
  9. blame: make diff algorithm configurableAntonin Delpeuch via GitGitGadget, Oct 28, 2025
  10. Phillip WoodOct 29, 2025
  11. Junio C HamanoOct 29, 2025
  12. Antonin DelpeuchOct 30, 2025
  13. Phillip WoodOct 30, 2025
  14. 0/2 blame: make diff algorithm configurableAntonin Delpeuch via GitGitGadget, Nov 1, 2025
  15. 1/2 xdiff: add 'minimal' to XDF_DIFF_ALGORITHM_MASKAntonin Delpeuch via GitGitGadget, Nov 1, 2025
  16. Phillip WoodNov 3, 2025
  17. 2/2 blame: make diff algorithm configurableAntonin Delpeuch via GitGitGadget, Nov 1, 2025
  18. Phillip WoodNov 3, 2025
  19. Junio C HamanoNov 3, 2025
  20. Junio C HamanoNov 6, 2025
  21. 0/2 blame: make diff algorithm configurableAntonin Delpeuch via GitGitGadget, Nov 6, 2025
  22. 1/2 xdiff: add 'minimal' to XDF_DIFF_ALGORITHM_MASKAntonin Delpeuch via GitGitGadget, Nov 6, 2025
  23. Junio C HamanoNov 7, 2025
  24. 2/2 blame: make diff algorithm configurableAntonin Delpeuch via GitGitGadget, Nov 6, 2025
  25. Junio C HamanoNov 7, 2025
  26. Phillip WoodNov 7, 2025
  27. Junio C HamanoNov 17, 2025
  28. 0/2 blame: make diff algorithm configurableAntonin Delpeuch via GitGitGadget, Nov 17, 2025
  29. 1/2 xdiff: add 'minimal' to XDF_DIFF_ALGORITHM_MASKAntonin Delpeuch via GitGitGadget, Nov 17, 2025
  30. 2/2 blame: make diff algorithm configurableAntonin Delpeuch via GitGitGadget, Nov 17, 2025
  31. Phillip WoodNov 17, 2025
  32. Junio C HamanoNov 17, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.