From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Teng Long <dyroneteng@gmail.com>,
git@vger.kernel.org, tenglong.tl@alibaba-inc.com
Subject: Re: [RFC PATCH v1 0/1] ls-remote: inconsistency from the order of args and opts
Date: Sat, 15 Jan 2022 01:34:28 +0100 [thread overview]
Message-ID: <220115.86lezhrg0o.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <xmqqo84e9e9g.fsf@gitster.g>
On Fri, Jan 14 2022, Junio C Hamano wrote:
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>>>> But when GNU came around its option parser was generally happy to accept
>>>> options and args in either order. E.g. these both work with GNU
>>>> coreutils, but the latter will fail on FreeBSD and various other
>>>> capital-U UNIX-es:
>>>>
>>>> touch foo; rm -v foo
>>>> touch foo; rm foo -v
>>
>> This is only an approximate list, but:
>
> Don't waste your time on this, and instead spend on something more
> useful. What I gave wrt gitcli.txt in an earlier message is final.
Whatever we do with git-ls-remote (which I don't really care all that
much about) gitcli should really be documenting how our tooling behaves.
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.
What do you think about something like this to clear this up?:
diff --git a/Documentation/gitcli.txt b/Documentation/gitcli.txt
index 92e4ba6a2fa..b1387c4fe68 100644
--- a/Documentation/gitcli.txt
+++ b/Documentation/gitcli.txt
@@ -19,6 +19,13 @@ Many commands take revisions (most often "commits", but sometimes
"tree-ish", depending on the context and command) and paths as their
arguments. Here are the rules:
+ * 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.
+
* Revisions come first and then paths.
E.g. in `git diff v1.0 v2.0 arch/x86 include/asm-x86`,
`v1.0` and `v2.0` are revisions and `arch/x86` and `include/asm-x86`
next prev parent reply other threads:[~2022-01-15 0:36 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-14 4:24 [RFC PATCH v1 0/1] ls-remote: inconsistency from the order of args and opts Teng Long
2022-01-14 4:24 ` [RFC PATCH v1 1/1] ls-remote: Make the output independent of the order of opts and <remote> Teng Long
2022-01-14 5:47 ` [RFC PATCH v1 0/1] ls-remote: inconsistency from the order of args and opts Junio C Hamano
2022-01-14 6:27 ` Junio C Hamano
2022-01-14 6:42 ` Teng Long
2022-01-15 0:25 ` Junio C Hamano
2022-01-14 19:57 ` Ævar Arnfjörð Bjarmason
2022-01-14 20:42 ` Junio C Hamano
2022-01-14 20:57 ` Ævar Arnfjörð Bjarmason
2022-01-14 21:52 ` Junio C Hamano
2022-01-15 0:34 ` Ævar Arnfjörð Bjarmason [this message]
2022-01-15 1:01 ` Junio C Hamano
2022-01-14 21:12 ` brian m. carlson
2022-01-15 0:13 ` Ævar Arnfjörð Bjarmason
2022-01-15 0:50 ` Junio C Hamano
2022-01-15 1:02 ` Ævar Arnfjörð Bjarmason
2022-01-15 1:19 ` Junio C Hamano
2022-01-17 6:27 ` Teng Long
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=220115.86lezhrg0o.gmgdl@evledraar.gmail.com \
--to=avarab@gmail.com \
--cc=dyroneteng@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=tenglong.tl@alibaba-inc.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).