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
Junio C Hamano <gitster@pobox.com>
Date
Jan 15, 2022, 01:01 UTC
Message-ID
<xmqqk0f16cd5.fsf@gitster.g>
In-Reply-To
<220115.86lezhrg0o.gmgdl@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 5 quoted lines
> Which is what I was mainly pointing out upthread, that your summary of
> options before other types of args omitted that many utilities support
> the reverse. Or perhaps you were only describing an asthetic choice
> (which I don't think is worth debating). I'm just talking about what the
> ground truth is.

The ground truth is that it is unlikely that we can fix some of our commands so that they stop taking options that are given after args, because of inertia. But we can teach users especially the new ones to always use the canonical order to sidestep the whole "some subcommands imitate misguided GNUism to make it ambiguous, some don't" problem.

> What do you think about something like this to clear this up?:

As we should aspire to fix the misguided "options can come still after we saw args" eventually (don't talk back on this point to waste any more of my time on a release day), I do not think it is a good idea to say "reverse is often not true" and stopping there.

It will mislead people to think these "not true" commands should somehow be updated to the GNUism in the future. It's the other way around.

Show 6 quoted lines
> + * Options are (almost) universally accpted before other types of
> +   arguments, e.g. `git cat-file -t HEAD` or `git push --dry-run
> +   origin`, but in the case of those commands a GNU-style `git
> +   cat-file HEAD -t` and `git push origin --dry-run` would work just
> +   as well. The reverse is often not true, many commands do not accept
> +   options after non-option arguments.
  * A subcommand may take dashed options (which may take their own
    arguments, e.g. "--max-parents 2") and arguments.  You SHOULD
    give dashed options first and then arguments.  Some commands may
    accept dashed options after you have already gave non-option
    arguments (which may make the command ambiguous), but you should
    not rely on it (because eventually we may find a way to fix
    these ambiguity by enforcing the "options then args" rule).
Previous: Ævar Arnfjörð BjarmasonNext: brian m. carlson
Message 12 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.