Re: [RFC PATCH v1 0/1] ls-remote: inconsistency from the order of args and opts
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Jan 15, 2022, 01:02 UTC
- Message-ID
- <220115.86czktrelu.gmgdl@evledraar.gmail.com>
- In-Reply-To
- <xmqqr1996cw2.fsf@gitster.g>
On Fri, Jan 14 2022, Junio C Hamano wrote:
Show 9 quoted lines
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes: > >> But we should really be recommending use of -- or --end-of-options >> whenever possible, as it can be hard to know in Git's CLI whether >> options after args are accepted or not. > > Way before doing so, we should recommend the "options and then args" > order. Users do not have to know which subcommands accepts options > after args.
If you want to script git to do e.g.:
touch -- foo -r
git add foo -r
git rm foo -r
git status foo -r
git log foo -rYou do need to know that those won't work, if that "foo -r" is from e.g. scripted arguments that those commands will accept or interpret that -r as an argument.
Hence suggesting that the user just add "--" to resolve the ambiguity, as gitcli already discusses.