From: Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH 2/2] rebase --root: fix amending root commit messages
Date: Sat, 16 Jun 2018 21:00:38 +0200 [thread overview]
Message-ID: <6f492ded5c4b9ee82501433d5a5227bc3e546c31.1529177176.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.3.git.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>
The code path that triggered that "BUG" really does not want to run
without an explicit commit message. In the case where we want to amend a
commit message, we have an *implicit* commit message, though: the one of
the commit to amend. Therefore, this code path should not even be
entered.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
sequencer.c | 2 +-
t/t3404-rebase-interactive.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sequencer.c b/sequencer.c
index cca968043..4034c0461 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -784,7 +784,7 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts,
struct child_process cmd = CHILD_PROCESS_INIT;
const char *value;
- if (flags & CREATE_ROOT_COMMIT) {
+ if ((flags & CREATE_ROOT_COMMIT) && !(flags & AMEND_MSG)) {
struct strbuf msg = STRBUF_INIT, script = STRBUF_INIT;
const char *author = is_rebase_i(opts) ?
read_author_ident(&script) : NULL;
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index ca94c688d..e500d7c32 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -971,7 +971,7 @@ test_expect_success 'rebase -i --root fixup root commit' '
test 0 = $(git cat-file commit HEAD | grep -c ^parent\ )
'
-test_expect_failure 'rebase -i --root reword root commit' '
+test_expect_success 'rebase -i --root reword root commit' '
test_when_finished "test_might_fail git rebase --abort" &&
git checkout -b reword-root-branch master &&
set_fake_editor &&
--
2.17.0.windows.1
next prev parent reply other threads:[~2018-06-16 19:26 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-16 19:26 [PATCH 0/2] rebase --root: fix `reword` on a root commit Johannes Schindelin via GitGitGadget
2018-06-15 4:31 ` [PATCH 1/2] rebase --root: demonstrate a bug while amending root commit messages Johannes Schindelin via GitGitGadget
2018-06-18 10:25 ` [PATCH 1/2] rebase --root: demonstrate a bug while amending rootcommit messages Phillip Wood
2018-06-18 16:49 ` Todd Zullinger
2018-06-18 21:46 ` Johannes Schindelin
2018-06-18 22:19 ` [PATCH] t3404: check root commit in 'rebase -i --root reword root commit' Todd Zullinger
2018-06-19 6:54 ` Johannes Schindelin
2018-06-19 16:00 ` Junio C Hamano
2018-06-19 19:12 ` Todd Zullinger
2018-06-20 11:03 ` Johannes Schindelin
2018-06-19 16:21 ` Junio C Hamano
2018-06-20 11:04 ` Johannes Schindelin
2018-06-16 19:00 ` Johannes Schindelin via GitGitGadget [this message]
2018-06-16 20:11 ` [PATCH 0/2] rebase --root: fix `reword` on a root commit Todd Zullinger
2018-06-18 16:21 ` Junio C Hamano
2018-06-18 16:41 ` Todd Zullinger
2018-06-18 19:25 ` 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=6f492ded5c4b9ee82501433d5a5227bc3e546c31.1529177176.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=johannes.schindelin@gmx.de \
/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).