From: Eric Sunshine <sunshine@sunshineco.com>
To: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [RFC][PATCH] git-stash: convert git stash list to C builtin
Date: Sun, 25 Mar 2018 03:08:41 -0400 [thread overview]
Message-ID: <CAPig+cS9QwCOG7BA7O5Nu_zsh-xTbDFy2vTWpAXxBuKTY-uzUw@mail.gmail.com> (raw)
In-Reply-To: <20180324182313.13705-1-ungureanupaulsebastian@gmail.com>
On Sat, Mar 24, 2018 at 2:23 PM, Paul-Sebastian Ungureanu
<ungureanupaulsebastian@gmail.com> wrote:
> Currently, because git stash is not fully converted to C, I
> introduced a new helper that will hold the converted commands.
> ---
> diff --git a/builtin/stash--helper.c b/builtin/stash--helper.c
> @@ -0,0 +1,52 @@
> +int cmd_stash__helper(int argc, const char **argv, const char *prefix)
> +{
> + int cmdmode = 0;
> +
> + struct option options[] = {
> + OPT_CMDMODE(0, "list", &cmdmode,
> + N_("list stash entries"), LIST_STASH),
> + OPT_END()
> + };
Is the intention that once git-stash--helper implements all 'stash'
functionality, you will simply rename git-stash--helper to git-stash?
If so, then I'd think that you'd want it to accept subcommand
arguments as bare words ("apply", "drop") in order to be consistent
with the existing git-stash command set, not in dashed form
("--apply", "--drop"). In that case, OPT_CMDMODE doesn't seem
appropriate. Instead, you should be consulting argv[] directly (as in
[1]) after parse_options().
[1]: https://public-inbox.org/git/20180324173707.17699-2-joel@teichroeb.net/
> + argc = parse_options(argc, argv, prefix, options,
> + git_stash__helper_usage, PARSE_OPT_KEEP_UNKNOWN);
> +
> + if (!cmdmode)
> + usage_with_options(git_stash__helper_usage, options);
> +
> + switch (cmdmode) {
> + case LIST_STASH:
> + return list_stash(argc, argv, prefix);
> + }
> + return 0;
> +}
> diff --git a/git.c b/git.c
> @@ -466,6 +466,7 @@ static struct cmd_struct commands[] = {
> { "show-branch", cmd_show_branch, RUN_SETUP },
> { "show-ref", cmd_show_ref, RUN_SETUP },
> { "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE },
> + { "stash--helper", cmd_stash__helper, RUN_SETUP },
You don't require a working tree? Seems odd for git-stash.
> { "status", cmd_status, RUN_SETUP | NEED_WORK_TREE },
> { "stripspace", cmd_stripspace },
> { "submodule--helper", cmd_submodule__helper, RUN_SETUP | SUPPORT_SUPER_PREFIX},
next prev parent reply other threads:[~2018-03-25 7:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-24 18:23 [RFC][PATCH] git-stash: convert git stash list to C builtin Paul-Sebastian Ungureanu
2018-03-25 7:08 ` Eric Sunshine [this message]
2018-03-26 19:03 ` Johannes Schindelin
2018-03-26 20:58 ` Thomas Gummerer
2018-03-30 10:29 ` Johannes Schindelin
2018-04-03 21:38 ` Paul-Sebastian Ungureanu
2018-04-07 8:56 ` Eric Sunshine
2018-04-07 8:58 ` Eric Sunshine
2018-03-25 18:43 ` Thomas Gummerer
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=CAPig+cS9QwCOG7BA7O5Nu_zsh-xTbDFy2vTWpAXxBuKTY-uzUw@mail.gmail.com \
--to=sunshine@sunshineco.com \
--cc=git@vger.kernel.org \
--cc=ungureanupaulsebastian@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).