Subject: Re: [PATCH] merge-file: warn for implicit 'myers' algorithm

From: Junio C Hamano <[email-masked]>
Date: Wed, 03 Jul 2024 13:19:08 -0700

Antonin Delpeuch <[email-masked]> writes:

> I'm really sorry, I thought the switch of default and migration
> plan had already been agreed on in our discussion of my earlier
> patch.

Ahh, OK.

So we did some time ago floated the idea.  I do not remember how
widely accepted the proposal was, though.  Having a such reference
and an explicit mention of what we have and not have yet reached
consensus on (either in cover letter or after the three-dash line)
would have been very much helpful.

> I think relying on `diff.algorithm` is a natural idea, but it
> might also be confusing for users.  At least to me, the name
> `diff.algorithm` suggests that it's the algorithm used for "git
> diff", but I might not realize that it also influences how my
> merges are done.  It's probably common to want different
> algorithms for those situations as they require different speed
> and accuracy trade-offs.

I never thought that we should get rid of one-off command line
option.  After all, we started with command line option to support
such one-off tweaks in the earlier 4f7fd79e (merge-file: add
--diff-algorithm option, 2023-11-20) for that exact reason.

The need to have one-off capability is orthogonal to the need to
allow users to choose their own default via the configuration.  We
want to have both, given that some commands other than "git diff"
already honor the `diff.THING` configuration variables.  Doesn't
"git log -p" already pay attention to "diff.algorithm" among other
"diff.THING" variables?

A possible downside I had envisioned was that depending on the
application (i.e. "diff" that produces a patch vs an internal
implementation detail of "merge-file") the users may want to choose
the value of "diff.THING" differently.  But then we can use the
"'diff.THING' is used as the default, but 'diff.frotz.THING', when
defined, overrides the choice inside the 'git frotz' program as a
more specific configuration" pattern.

In any case, honoring things like

    [diff] algorithm = default
    [diff "merge-file"] algorithm = default

in the configuration file might be a reasonable way out to prepare
that users will have a way to squelch the warning messages.

Thanks.