All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Quentin Bernet via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org,  Quentin Bernet <quentin.bernet@bluewin.ch>
Subject: Re: [PATCH v2] docs: fix "git stash [push]" documentation
Date: Mon, 30 Mar 2026 08:18:58 -0700	[thread overview]
Message-ID: <xmqq341hfiql.fsf@gitster.g> (raw)
In-Reply-To: <pull.2255.v2.git.git.1774877075694.gitgitgadget@gmail.com> (Quentin Bernet via GitGitGadget's message of "Mon, 30 Mar 2026 13:24:35 +0000")

"Quentin Bernet via GitGitGadget" <gitgitgadget@gmail.com> writes:

> But it also adds "-p" to the list of exceptions, even though it is an
> option argument.

This point I did not notice before, and you are right.  We already
said that we reject non-option arguments, and "-p" is by no means
special among other options.  Good spotting.

>
> -git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]
> +git stash [push] [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]
>  	     [-u | --include-untracked] [-a | --all] [(-m | --message) <message>]
>  	     [--pathspec-from-file=<file> [--pathspec-file-nul]]
> -	     [--] [<pathspec>...]]
> +	     [--] [<pathspec>...]

OK.  So the first '[' was closed after the entire thing, but now it
closes after [push], making it clear that the command word can be
omitted without affecting the remainder.

> @@ -60,10 +60,8 @@ COMMANDS
>  	the description along with the stashed state.
>  +
>  For quickly making a snapshot, you can omit "push".  In this mode,
> -non-option arguments are not allowed to prevent a misspelled
> -subcommand from making an unwanted stash entry.  The two exceptions to this
> -are `stash -p` which acts as alias for `stash push -p` and pathspec elements,
> -which are allowed after a double hyphen `--` for disambiguation.
> +pathspec elements are only allowed after a double hyphen `--`
> +to prevent a misspelled subcommand from making an unwanted stash entry.

OK.  I personally think "for disambiguation" in the original is
clear enough, but the rephrased version is not excessively verbose,
so let's take it.

> -	N_("git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n" \
> +	N_("git stash [push] [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n" \
>  	   "          [-u | --include-untracked] [-a | --all] [(-m | --message) <message>]\n" \
>  	   "          [--pathspec-from-file=<file> [--pathspec-file-nul]]\n" \
> -	   "          [--] [<pathspec>...]]")
> +	   "          [--] [<pathspec>...]")

OK.  Looking ver good.  Does this excatly match what we have in the
documentation?  I think we have a test for it, but I do not offhand
recall it covers "git stash".

Thanks.  Will queue.


>  #define BUILTIN_STASH_SAVE_USAGE \
>  	N_("git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n" \
>  	   "          [-u | --include-untracked] [-a | --all] [<message>]")
>
> base-commit: ce74208c2fa13943fffa58f168ac27a76d0eb789

  reply	other threads:[~2026-03-30 15:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-26 12:45 [PATCH] docs: fix git stash grammar Quentin Bernet via GitGitGadget
2026-03-26 16:17 ` D. Ben Knoble
2026-03-27  0:04   ` Mirko Faina
2026-03-27 15:58     ` Junio C Hamano
2026-03-27 16:28       ` Quentin Bernet
2026-03-27 16:53         ` Junio C Hamano
2026-03-27 16:58           ` Quentin Bernet
2026-03-27 17:16             ` Junio C Hamano
2026-03-27 17:36               ` Quentin Bernet
2026-03-27 17:45                 ` Junio C Hamano
2026-03-27 16:47     ` Ben Knoble
2026-03-27  8:25   ` Quentin Bernet
2026-03-30 13:24 ` [PATCH v2] docs: fix "git stash [push]" documentation Quentin Bernet via GitGitGadget
2026-03-30 15:18   ` Junio C Hamano [this message]
2026-03-30 17:19     ` Quentin Bernet

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=xmqq341hfiql.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=quentin.bernet@bluewin.ch \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.