git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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 -r

You 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.

Previous: Junio C HamanoNext: Junio C Hamano
Message 16 of 18 in “ls-remote: inconsistency from the order of args and opts”
  1. 0/1 ls-remote: inconsistency from the order of args and optsTeng Long, Jan 14, 2022
  2. 1/1 ls-remote: Make the output independent of the order of opts and <remote>Teng Long, Jan 14, 2022
  3. Junio C HamanoJan 14, 2022
  4. Junio C HamanoJan 14, 2022
  5. Teng LongJan 14, 2022
  6. Junio C HamanoJan 15, 2022
  7. Ævar Arnfjörð BjarmasonJan 14, 2022
  8. Junio C HamanoJan 14, 2022
  9. Ævar Arnfjörð BjarmasonJan 14, 2022
  10. Junio C HamanoJan 14, 2022
  11. Ævar Arnfjörð BjarmasonJan 15, 2022
  12. Junio C HamanoJan 15, 2022
  13. brian m. carlsonJan 14, 2022
  14. Ævar Arnfjörð BjarmasonJan 15, 2022
  15. Junio C HamanoJan 15, 2022
  16. Ævar Arnfjörð BjarmasonJan 15, 2022
  17. Junio C HamanoJan 15, 2022
  18. Teng LongJan 17, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.