From: Junio C Hamano <gitster@pobox.com>
To: Antonin Delpeuch <antonin@delpeuch.eu>
Cc: Elijah Newren <newren@gmail.com>,
Antonin Delpeuch via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org, Phillip Wood <phillip.wood123@gmail.com>
Subject: Re: [PATCH] merge-file: warn for implicit 'myers' algorithm
Date: Sat, 06 Jul 2024 11:06:09 -0700 [thread overview]
Message-ID: <xmqqzfqupf8u.fsf@gitster.g> (raw)
In-Reply-To: <7bc2ff20-98b8-45d7-95b8-e1b09bdeda07@delpeuch.eu> (Antonin Delpeuch's message of "Sat, 6 Jul 2024 15:30:45 +0200")
Antonin Delpeuch <antonin@delpeuch.eu> writes:
> In the documentation of the recursive merge strategy (for instance in
> "man git-merge"), it is claimed that "recursive defaults to the
> diff.algorithm config setting". As far as I can tell, both from my
> reading of the code and my interactive testing, this is wrong. This
> affects the "merge", "rebase" and "pull" commands, which all three
> mention this configuration variable in their man page without respecting
> it. Ouch!
Thanks for digging.
> I have looked for all commands which mention diff.algorithm in their man
> page and checked whether they indeed respect it. The "diff-index",
> "diff-tree" and "diff-files" commands also make this erroneous claim.
It is not erroneous if we say that these 3 diff plumbing commands
ignore the configuration variable. They should ignore end-user
configuration for reproducibility.
See also my earlier response to Elijah <xmqqed873vgn.fsf@gitster.g>
on a related topic.
> The --diff-algorithm CLI option (as well as the --histogram and
> siblings) are respected, but not the diff.algorithm config variable.
Then they are behaving exactly as designed, which is good. We still
need to correct their documentation, though.
> Those inconsistencies seem to be caused by the inclusion of the
> `diff-options.txt` file in the man pages, which leads their man pages to
> documenting a bunch of config variables which are in fact ignored.
That is quite understandable mistake ;-) "git merge" and other
end-user facing commands should be taught to pay attention to both
the command line option and the configuration variable. The
plumbing commands should pay attention to the command line only.
> In any case, I would of course make sure the "ort" strategy continues to
> ignore diff.algorithm for now, given its current default value.
It may make the effort easy to follow if you do this step-wise:
(1) start with "all Porcelain commands pay attention to the same
diff.algorithm variable. The plumbing commands ignore
diff.algorithm. All commands, either Porcelain or plumbing,
may have different default when unconfigured (like ort does)".
(2) then add "each Porcelain command <cmd> pays attention to
diff.<cmd>.algorithm if defined, otherwise diff.algorithm is
used as a fallback default. There is no diff.<cmd>.algorithm
for plumbing commands---they are designed not to be affected by
the configuration variables".
(3) optionally, doing "all Porcelain commands, when not configured,
will use the same default (ort is no longer special---everybody
falls back to algorithm X)" may be desiable for consistency and
simplicity, but it would probably want further discussion can
be left outside of the topic (e.g. right now the best candidate
for X may be histogram, but is it suitable for all commands?
should this extend to plumbing, making diff-index for example
to use X as the default not myers when the command line does
not specify --diff-algorithm?)
Thanks.
prev parent reply other threads:[~2024-07-06 18:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-03 14:21 [PATCH] merge-file: warn for implicit 'myers' algorithm Antonin Delpeuch via GitGitGadget
2024-07-03 17:30 ` Junio C Hamano
2024-07-03 18:28 ` Antonin Delpeuch
2024-07-03 20:19 ` Junio C Hamano
2024-07-05 17:39 ` Elijah Newren
2024-07-05 20:14 ` Antonin Delpeuch
2024-07-06 6:06 ` Junio C Hamano
2024-07-06 13:30 ` Antonin Delpeuch
2024-07-06 18:06 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqzfqupf8u.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=antonin@delpeuch.eu \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=newren@gmail.com \
--cc=phillip.wood123@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).