Re: [PATCH v4 2/2] blame: make diff algorithm configurable
From: Junio C Hamano <hidden>
Date: 2025-11-03 16:15:50
Phillip Wood [off-list ref] writes:
One thing I'd not thought about before was the interaction between "--no-minimal" and "--diff-algorithm" The code above makes "--no-minimal" behave like "diff-algorithm=myers" which is consistent with the current behavior where the only options for the diff algorithm are "minimal" or "myers". An alternative would be for "--no-minimal" to just clear XDF_NEED_MINIMAL and behave like a no-op if it is given after "--diff-algorithm=patience" or "--diff-algorithm=histogram". I don't really have a strong preference either way.
Good observation.
In the longer term, I think we would be better off if we treated
"minimal" just like "histogram" and "patience", in that
(1) If the command takes --diff-algorithm=<name>, giving it as the
<name> would override the previous setting.
(2) If the command takes --<name> (i.e. "git diff --histogram"),
giving "--no-<name>" results in an error.
(3) If the command takes --<name>, it should take all the variants
as <name>, not just selected few, or it shouldn't take any.
IOW, we should deprecate "blame --no-minimal" as a past mistake, and
in the longer term deprecate "blame --minimal" and tell users to use
"--diff-algorithm=minimal" instead.
If Antonin's series wants to teach --histogram and --patience to
"git blame", then we can and should keep "blame --minimal" (i.e.,
(3) above), but in that case, "blame --no-minimal" should still go
(i.e., (2) above). Under the new world order where there are more
than the "minimal/no-minimal?" binary choice, where you can specify
other algorithms from the usual repertoire, the option "no-minimal"
no longer makes sense.