git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: Pratik Karki <predatoramigo@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
	Christian Couder <christian.couder@gmail.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Stefan Beller <sbeller@google.com>,
	alban.gruin@gmail.com, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 11/18] builtin rebase: support `--autostash` option
Date: Sat, 18 Aug 2018 17:59:41 +0200	[thread overview]
Message-ID: <CACsJy8CS5aABuQrqWxdfLOTbFRhQDQ+tFO+wOCLTdeJG8mH0hw@mail.gmail.com> (raw)
In-Reply-To: <20180808152140.14585-12-predatoramigo@gmail.com>

On Wed, Aug 8, 2018 at 5:26 PM Pratik Karki <predatoramigo@gmail.com> wrote:
> @@ -224,13 +219,56 @@ static int read_basic_state(struct rebase_options *opts)
>         return 0;
>  }
>
> +static int apply_autostash(struct rebase_options *opts)
> +{
> +       const char *path = state_dir_path("autostash", opts);
> +       struct strbuf autostash = STRBUF_INIT;
> +       struct child_process stash_apply = CHILD_PROCESS_INIT;
> +
> +       if (!file_exists(path))
> +               return 0;
> +
> +       if (read_one(state_dir_path("autostash", opts), &autostash))
> +               return error(_("Could not read '%s'"), path);
> +       argv_array_pushl(&stash_apply.args,
> +                        "stash", "apply", autostash.buf, NULL);
> +       stash_apply.git_cmd = 1;
> +       stash_apply.no_stderr = stash_apply.no_stdout =
> +               stash_apply.no_stdin = 1;
> +       if (!run_command(&stash_apply))
> +               printf("Applied autostash.\n");

I think you need _() here.

> +       else {
> +               struct argv_array args = ARGV_ARRAY_INIT;
> +               int res = 0;
> +
> +               argv_array_pushl(&args,
> +                                "stash", "store", "-m", "autostash", "-q",
> +                                autostash.buf, NULL);
> +               if (run_command_v_opt(args.argv, RUN_GIT_CMD))
> +                       res = error(_("Cannot store %s"), autostash.buf);
> +               argv_array_clear(&args);
> +               strbuf_release(&autostash);
> +               if (res)
> +                       return res;
> +
> +               fprintf(stderr,
> +                       _("Applying autostash resulted in conflicts.\n"
> +                         "Your changes are safe in the stash.\n"
> +                         "You can run \"git stash pop\" or \"git stash drop\" "
> +                         "at any time.\n"));
> +       }
> +
> +       strbuf_release(&autostash);
> +       return 0;
> +}
> +
>  static int finish_rebase(struct rebase_options *opts)
>  {
>         struct strbuf dir = STRBUF_INIT;
>         const char *argv_gc_auto[] = { "gc", "--auto", NULL };
>
>         delete_ref(NULL, "REBASE_HEAD", NULL, REF_NO_DEREF);
> -       apply_autostash();
> +       apply_autostash(opts);
>         close_all_packs(the_repository->objects);
>         /*
>          * We ignore errors in 'gc --auto', since the
-- 
Duy

  reply	other threads:[~2018-08-18 16:00 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-08 15:21 [GSoC] [PATCH 00/18] builtin rebase options Pratik Karki
2018-08-08 15:21 ` [PATCH 01/18] builtin rebase: allow selecting the rebase "backend" Pratik Karki
2018-08-08 15:21 ` [PATCH 02/18] builtin rebase: support --signoff Pratik Karki
2018-08-08 15:21 ` [PATCH 03/18] builtin rebase: support --rerere-autoupdate Pratik Karki
2018-08-08 15:21 ` [PATCH 04/18] builtin rebase: support --committer-date-is-author-date Pratik Karki
2018-08-08 15:21 ` [PATCH 05/18] builtin rebase: support `ignore-whitespace` option Pratik Karki
2018-08-08 15:21 ` [PATCH 06/18] builtin rebase: support `ignore-date` option Pratik Karki
2018-08-08 15:21 ` [PATCH 07/18] builtin rebase: support `keep-empty` option Pratik Karki
2018-08-24 16:04   ` Johannes Schindelin
2018-08-08 15:21 ` [PATCH 08/18] builtin rebase: support `--autosquash` Pratik Karki
2018-08-08 15:21 ` [PATCH 09/18] builtin rebase: support `--gpg-sign` option Pratik Karki
2018-08-08 15:21 ` [PATCH 10/18] builtin rebase: support `-C` and `--whitespace=<type>` Pratik Karki
2018-08-08 15:21 ` [PATCH 11/18] builtin rebase: support `--autostash` option Pratik Karki
2018-08-18 15:59   ` Duy Nguyen [this message]
2018-08-24 16:06     ` Johannes Schindelin
2018-08-08 15:21 ` [PATCH 12/18] builtin rebase: support `--exec` Pratik Karki
2018-08-08 15:21 ` [PATCH 13/18] builtin rebase: support `--allow-empty-message` option Pratik Karki
2018-08-08 15:21 ` [PATCH 14/18] builtin rebase: support --rebase-merges[=[no-]rebase-cousins] Pratik Karki
2018-08-08 15:21 ` [PATCH 15/18] merge-base --fork-point: extract libified function Pratik Karki
2018-08-08 15:21 ` [PATCH 16/18] builtin rebase: support `fork-point` option Pratik Karki
2018-08-08 15:21 ` [PATCH 17/18] builtin rebase: add support for custom merge strategies Pratik Karki
2018-08-08 15:21 ` [PATCH 18/18] builtin rebase: support --root Pratik Karki
2018-09-04 21:59 ` [PATCH v2 00/18] builtin rebase options Johannes Schindelin via GitGitGadget
2018-09-04 21:59   ` [PATCH v2 01/18] builtin rebase: allow selecting the rebase "backend" Pratik Karki via GitGitGadget
2018-09-04 21:59   ` [PATCH v2 02/18] builtin rebase: support --signoff Pratik Karki via GitGitGadget
2018-09-04 21:59   ` [PATCH v2 03/18] builtin rebase: support --rerere-autoupdate Pratik Karki via GitGitGadget
2018-09-04 21:59   ` [PATCH v2 04/18] builtin rebase: support --committer-date-is-author-date Pratik Karki via GitGitGadget
2018-09-04 21:59   ` [PATCH v2 05/18] builtin rebase: support `ignore-whitespace` option Pratik Karki via GitGitGadget
2018-09-04 21:59   ` [PATCH v2 06/18] builtin rebase: support `ignore-date` option Pratik Karki via GitGitGadget
2018-09-04 21:59   ` [PATCH v2 07/18] builtin rebase: support `keep-empty` option Pratik Karki via GitGitGadget
2018-09-04 21:59   ` [PATCH v2 08/18] builtin rebase: support `--autosquash` Pratik Karki via GitGitGadget
2018-09-04 22:00   ` [PATCH v2 09/18] builtin rebase: support `--gpg-sign` option Pratik Karki via GitGitGadget
2018-09-04 22:00   ` [PATCH v2 10/18] builtin rebase: support `-C` and `--whitespace=<type>` Pratik Karki via GitGitGadget
2018-09-04 22:00   ` [PATCH v2 11/18] builtin rebase: support `--autostash` option Pratik Karki via GitGitGadget
2018-09-04 22:00   ` [PATCH v2 12/18] builtin rebase: support `--exec` Pratik Karki via GitGitGadget
2018-09-04 22:00   ` [PATCH v2 13/18] builtin rebase: support `--allow-empty-message` option Pratik Karki via GitGitGadget
2018-09-04 22:00   ` [PATCH v2 14/18] builtin rebase: support --rebase-merges[=[no-]rebase-cousins] Pratik Karki via GitGitGadget
2018-09-04 22:00   ` [PATCH v2 15/18] merge-base --fork-point: extract libified function Pratik Karki via GitGitGadget
2018-09-04 22:00   ` [PATCH v2 16/18] builtin rebase: support `fork-point` option Pratik Karki via GitGitGadget
2018-09-04 22:00   ` [PATCH v2 17/18] builtin rebase: add support for custom merge strategies Pratik Karki via GitGitGadget
2018-09-04 22:00   ` [PATCH v2 18/18] builtin rebase: support --root Pratik Karki via GitGitGadget
2018-09-06 19:50   ` [PATCH v2 00/18] builtin rebase options Junio C Hamano
2018-09-06 20:38     ` Junio C Hamano
2018-10-12 12:01     ` Johannes Schindelin

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=CACsJy8CS5aABuQrqWxdfLOTbFRhQDQ+tFO+wOCLTdeJG8mH0hw@mail.gmail.com \
    --to=pclouds@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=alban.gruin@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=predatoramigo@gmail.com \
    --cc=sbeller@google.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).