From: Jeff King <peff@peff.net>
To: Phil Hord <phil.hord@gmail.com>
Cc: Git <git@vger.kernel.org>, Thomas Gummerer <t.gummerer@gmail.com>
Subject: Re: [PATCH v2] Teach stash to parse -m/--message like commit does
Date: Wed, 22 Nov 2017 17:01:56 -0500 [thread overview]
Message-ID: <20171122220155.GD2854@sigill> (raw)
In-Reply-To: <20171122212031.5988-1-phil.hord@gmail.com>
On Wed, Nov 22, 2017 at 01:20:30PM -0800, Phil Hord wrote:
> `git stash push -m foo` uses "foo" as the message for the stash. But
> `git stash push -m"foo"` does not parse successfully. Similarly
> `git stash push --message="My stash message"` also fails. The stash
> documentation doesn't suggest this syntax should work, but gitcli
> does and my fingers have learned this pattern long ago for `commit`.
>
> Teach `git stash` and `git store` to parse -mFoo and --message=Foo
> the same as `git commit` would do. Even though it's an internal
> function, add similar support to create_stash() for consistency.
I definitely approve of the goal. The implementation looks pretty
straightforward given the current parsing scheme.
Many of our other scripts lean on "rev-parse --parseopt" to handle
options. E.g.:
OPTIONS="\
git foo [options]
--
m,message= stash message
"
foo() {
for i in "$@"; do echo " pre: $i"; done
eval "$(echo -n "$OPTIONS" | git rev-parse --parseopt -- "$@")"
for i in "$@"; do echo "post: $i"; done
}
foo -mmsg
foo -m msg
foo --message=msg
foo --message msg
should convert each of those into "-m msg". It also handles unique
partial options like "--mess", though IMHO that is not that big a deal.
Would it be possible to convert stash to use --parseopt? I'm fine if the
answer is "no", or even "yes, but it's tricky so let's do this in the
meantime". But I think that's the endgame we should be shooting for (or,
of course, doing the whole thing in C, which I think somebody else is
working on).
-Peff
next prev parent reply other threads:[~2017-11-22 22:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-22 21:20 [PATCH v2] Teach stash to parse -m/--message like commit does Phil Hord
2017-11-22 22:01 ` Jeff King [this message]
2017-11-24 5:47 ` Junio C Hamano
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=20171122220155.GD2854@sigill \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=phil.hord@gmail.com \
--cc=t.gummerer@gmail.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).