From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: phillip.wood@dunelm.org.uk
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] rebase -i: silence stash apply
Date: Thu, 18 May 2017 23:19:30 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.21.1.1705182318170.3610@virtualbox> (raw)
In-Reply-To: <decdfff1-dd21-4e10-44d5-9dbee38ba05f@talktalk.net>
Hi Phillip,
On Thu, 18 May 2017, Phillip Wood wrote:
> The shell version prints it's own error message if there's an error, the
> C version does this as well
>
> Shell version:
> apply_autostash () {
> if test -f "$state_dir/autostash"
> then
> stash_sha1=$(cat "$state_dir/autostash")
> if git stash apply $stash_sha1 2>&1 >/dev/null
> then
> echo "$(gettext 'Applied autostash.')"
> else
> git stash store -m "autostash" -q $stash_sha1 ||
> die "$(eval_gettext "Cannot store \$stash_sha1")"
> gettext 'Applying autostash resulted in conflicts.
> Your changes are safe in the stash.
> You can run "git stash pop" or "git stash drop" at any time.
> '
> fi
> fi
> }
>
> C version:
> static int apply_autostash(struct replay_opts *opts)
> {
> struct strbuf stash_sha1 = STRBUF_INIT;
> struct child_process child = CHILD_PROCESS_INIT;
> int ret = 0;
>
> if (!read_oneliner(&stash_sha1, rebase_path_autostash(), 1)) {
> strbuf_release(&stash_sha1);
> return 0;
> }
> strbuf_trim(&stash_sha1);
>
> child.git_cmd = 1;
> child.no_stdout = 1;
> child.no_stderr = 1;
> argv_array_push(&child.args, "stash");
> argv_array_push(&child.args, "apply");
> argv_array_push(&child.args, stash_sha1.buf);
> if (!run_command(&child))
> printf(_("Applied autostash.\n"));
> else {
> struct child_process store = CHILD_PROCESS_INIT;
>
> store.git_cmd = 1;
> argv_array_push(&store.args, "stash");
> argv_array_push(&store.args, "store");
> argv_array_push(&store.args, "-m");
> argv_array_push(&store.args, "autostash");
> argv_array_push(&store.args, "-q");
> argv_array_push(&store.args, stash_sha1.buf);
> if (run_command(&store))
> ret = error(_("cannot store %s"), stash_sha1.buf);
> else
> printf(_("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(&stash_sha1);
> return ret;
> }
Oh, you're right, I misremembered.
Thank you for being so thorough. This patch is Acked-by: me, then.
Thanks,
Johannes
prev parent reply other threads:[~2017-05-18 21:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-18 10:02 [PATCH 0/2] Fix a couple of minor rebase -i regressions Phillip Wood
2017-05-18 10:02 ` [PATCH 1/2] rebase -i: fix reflog message Phillip Wood
2017-05-18 10:02 ` [PATCH 2/2] rebase -i: silence stash apply Phillip Wood
2017-05-18 10:49 ` Johannes Schindelin
2017-05-18 14:51 ` Phillip Wood
2017-05-18 21:19 ` Johannes Schindelin [this message]
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=alpine.DEB.2.21.1.1705182318170.3610@virtualbox \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=phillip.wood@dunelm.org.uk \
/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