]> git.ipfire.org Git - thirdparty/git.git/commit
doc: option value may be separate for valid reasons
authorJunio C Hamano <gitster@pobox.com>
Mon, 25 Nov 2024 03:14:01 +0000 (12:14 +0900)
committerJunio C Hamano <gitster@pobox.com>
Mon, 25 Nov 2024 05:20:15 +0000 (14:20 +0900)
commit1bc1e940918cd44cc78bff1dfd518e16fc5bad57
tree7e7e0350bc121f74375cfdca563349bb4e32c118
parentf1a384425d5ce07db8f44bf173076620f89a1f4f
doc: option value may be separate for valid reasons

Even though `git help cli` recommends users to prefer using
"--option=value" over "--option value", there can be reasons why
giving them separately is a good idea.  One reason is that shells do
not perform tilde expansion for `--option=~/path/name` but they
expand `--options ~/path/name` just fine.

This is not a problem for many options whose option parsing is
properly written using OPT_FILENAME(), because the value given to
OPT_FILENAME() is tilde-expanded internally by us, but some commands
take a pathname as a mere string, which needs this trick to have the
shell help us.

I think the reason we originally decided to recommend the stuck form
was because an option that takes an optional value requires you to
use it in the stuck form, and it is one less thing for users to
worry about if they get into the habit to always use the stuck form.
But we should be discouraging ourselves from adding an option with
an optional value in the first place, and we might want to weaken
the current recommendation.

In any case, let's describe this one case where it is necessary to
use the separate form, with an example.

Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/gitcli.txt
Documentation/gitcredentials.txt