git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Robert P. J. Day" <rpjday@crashcourse.ca>
Cc: Git Mailing list <git@vger.kernel.org>
Subject: Re: [PATCH v3] doc: tweak "man gitcli" for clarity
Date: Fri, 24 Nov 2017 14:02:23 +0900	[thread overview]
Message-ID: <xmqqd148p8v4.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <alpine.LFD.2.21.1711220701070.12544@DESKTOP-1GPMCEJ> (Robert P. J. Day's message of "Wed, 22 Nov 2017 07:03:09 -0500 (EST)")

"Robert P. J. Day" <rpjday@crashcourse.ca> writes:

> -This manual describes the convention used throughout Git CLI.
> +This manual describes the conventions used throughout Git CLI.

OK.

>  Many commands take revisions (most often "commits", but sometimes
>  "tree-ish", depending on the context and command) and paths as their
> @@ -32,32 +32,35 @@ arguments.  Here are the rules:
>     between the HEAD commit and the work tree as a whole".  You can say
>     `git diff HEAD --` to ask for the latter.
>
> - * Without disambiguating `--`, Git makes a reasonable guess, but errors
> -   out and asking you to disambiguate when ambiguous.  E.g. if you have a
> -   file called HEAD in your work tree, `git diff HEAD` is ambiguous, and
> + * In cases where a Git command is truly ambiguous, Git will error out
> +   and ask you to disambiguate the command.  E.g. if you have a file
> +   called HEAD in your work tree, `git diff HEAD` is ambiguous, and
>     you have to say either `git diff HEAD --` or `git diff -- HEAD` to
>     disambiguate.
>  +
>  When writing a script that is expected to handle random user-input, it is
>  a good practice to make it explicit which arguments are which by placing
> -disambiguating `--` at appropriate places.
> +a disambiguating `--` at appropriate places.

The above "truly" is misleading by giving the information the other
way around.  We ask to disambiguate when we cannot readily say the
command line is *not* unambiguous.  That is different from asking
when we know it is truly ambiguous.

Also see <xmqq7eugqykq.fsf@gitster.mtv.corp.google.com> if you want
to know more.

>   * Many commands allow wildcards in paths, but you need to protect
> -   them from getting globbed by the shell.  These two mean different
> -   things:
> +   them from getting globbed by the shell.  The following commands have
> +   two different meanings:
>  +
>  --------------------------------
>  $ git checkout -- *.c
> +
>  $ git checkout -- \*.c
> +$ git checkout -- "*.c"
> +$ git checkout -- '*.c'

I do not think these two additional ones add any value.

And if you do not add these two, you do not need any of the change
we see before or after this example.  The changes you made to these
paragraphs are primarily there because you need to explain that the
latter three are equivalent to each other now because of these two
extra ones, while the original did not have to say anything like
that.

Because this is not a tutorial for shell scripting and its quoting
rules, highlighting the difference between the case where Git sees
the asterisk and you let shell to expand asterisk and do not let Git
see the asterisk _is_ important, but the fact that you can quote the
asterisk in different ways from the shell is *not* important.  We
shouldn't clutter the description with the latter, I would think.

I would however be receptive if the change were to only replace the
backslash quoting of asterisk with the one that uses a single quote
pair (and with no changes in the surrounding paragraphs).  That
change could be justified by saying that a pair of single (or
double) quotes would be more familiar for people new to the shell.

Thanks.

  reply	other threads:[~2017-11-24  5:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-22 12:03 [PATCH v3] doc: tweak "man gitcli" for clarity Robert P. J. Day
2017-11-24  5:02 ` Junio C Hamano [this message]
2017-11-24  6:23   ` Junio C Hamano
2017-11-24 10:39   ` Robert P. J. Day

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqd148p8v4.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=rpjday@crashcourse.ca \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).