summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2017-01-02 15:35:34 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-01-17 22:06:01 (GMT)
commit9a757c4970837162dfe4a64b70a428209c135641 (patch)
tree6e878507aee4875e0fb81a0f5276365db4882a53 /sequencer.c
parent07d968ef14ae4a783be690985ae77bbcee722c83 (diff)
downloadgit-9a757c4970837162dfe4a64b70a428209c135641.zip
git-9a757c4970837162dfe4a64b70a428209c135641.tar.gz
git-9a757c4970837162dfe4a64b70a428209c135641.tar.bz2
sequencer (rebase -i): show only failed `git commit`'s output
This is the behavior of the shell script version of the interactive rebase, by using the `output` function defined in `git-rebase.sh`. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sequencer.c b/sequencer.c
index 6d5d6c3..84534ee 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -610,6 +610,11 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts,
cmd.git_cmd = 1;
if (is_rebase_i(opts)) {
+ if (!edit) {
+ cmd.stdout_to_stderr = 1;
+ cmd.err = -1;
+ }
+
if (read_env_script(&cmd.env_array)) {
const char *gpg_opt = gpg_sign_opt_quoted(opts);
@@ -644,6 +649,19 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts,
if (opts->allow_empty_message)
argv_array_push(&cmd.args, "--allow-empty-message");
+ if (cmd.err == -1) {
+ /* hide stderr on success */
+ struct strbuf buf = STRBUF_INIT;
+ int rc = pipe_command(&cmd,
+ NULL, 0,
+ /* stdout is already redirected */
+ NULL, 0,
+ &buf, 0);
+ if (rc)
+ fputs(buf.buf, stderr);
+ strbuf_release(&buf);
+ return rc;
+ }
return run_command(&cmd);
}