git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Phillip Wood via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
	"SZEDER Gábor" <szeder.dev@gmail.com>,
	"Phillip Wood" <phillip.wood@dunelm.org.uk>,
	"Phillip Wood" <phillip.wood@dunelm.org.uk>
Subject: [PATCH 4/4] rebase -r: fix merge -c with a merge strategy
Date: Fri, 13 Aug 2021 13:07:33 +0000	[thread overview]
Message-ID: <f2a2e3531a181f68cee43f832045633aee519fb8.1628860053.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1015.git.1628860053.gitgitgadget@gmail.com>

From: Phillip Wood <phillip.wood@dunelm.org.uk>

If a rebase is started with a --strategy option other than "ort" or
"recursive" then "merge -c" does not allow the user to reword the
commit message.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
---
 sequencer.c              |  5 ++++-
 t/t3430-rebase-merges.sh | 18 ++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/sequencer.c b/sequencer.c
index c2cba5ed4b1..a19980f62d9 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -3934,7 +3934,10 @@ static int do_merge(struct repository *r,
 				strvec_pushf(&cmd.args,
 					     "-X%s", opts->xopts[k]);
 		}
-		strvec_push(&cmd.args, "--no-edit");
+		if (!(flags & TODO_EDIT_MERGE_MSG))
+			strvec_push(&cmd.args, "--no-edit");
+		else
+			strvec_push(&cmd.args, "--edit");
 		strvec_push(&cmd.args, "--no-ff");
 		strvec_push(&cmd.args, "--no-log");
 		strvec_push(&cmd.args, "--no-stat");
diff --git a/t/t3430-rebase-merges.sh b/t/t3430-rebase-merges.sh
index 183c3a23838..43c82d9a33b 100755
--- a/t/t3430-rebase-merges.sh
+++ b/t/t3430-rebase-merges.sh
@@ -187,6 +187,24 @@ test_expect_success 'merge -c commits before rewording and reloads todo-list' '
 	check_reworded_commits E H
 '
 
+test_expect_success 'merge -c rewords when a strategy is given' '
+	git checkout -b merge-c-with-strategy H &&
+	write_script git-merge-override <<-\EOF &&
+	echo overridden$1 >G.t
+	git add G.t
+	EOF
+
+	PATH="$PWD:$PATH" \
+	GIT_SEQUENCE_EDITOR="echo merge -c H G >" \
+	GIT_EDITOR="echo edited >>" \
+		git rebase --no-ff -ir -s override -Xxopt E &&
+	test_write_lines overridden--xopt >expect &&
+	test_cmp expect G.t &&
+	test_write_lines H "" edited "" >expect &&
+	git log --format=%B -1 >actual &&
+	test_cmp expect actual
+
+'
 test_expect_success 'with a branch tip that was cherry-picked already' '
 	git checkout -b already-upstream main &&
 	base="$(git rev-parse --verify HEAD)" &&
-- 
gitgitgadget

  parent reply	other threads:[~2021-08-13 13:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-13 13:07 [PATCH 0/4] rebase -r: some merge related fixes Phillip Wood via GitGitGadget
2021-08-13 13:07 ` [PATCH 1/4] rebase -r: make 'merge -c' behave like reword Phillip Wood via GitGitGadget
2021-08-13 13:07 ` [PATCH 2/4] rebase -i: Add another reword test Phillip Wood via GitGitGadget
2021-08-13 13:07 ` [PATCH 3/4] rebase -r: don't write .git/MERGE_MSG when fast-forwarding Phillip Wood via GitGitGadget
2021-08-17 17:26   ` SZEDER Gábor
2021-08-19 10:09     ` Phillip Wood
2021-08-13 13:07 ` Phillip Wood via GitGitGadget [this message]
2021-08-14 22:43 ` [PATCH 0/4] rebase -r: some merge related fixes Johannes Schindelin
2021-08-19 10:07   ` Phillip Wood
2021-08-20 15:40 ` [PATCH v2 " Phillip Wood via GitGitGadget
2021-08-20 15:40   ` [PATCH v2 1/4] rebase -r: make 'merge -c' behave like reword Phillip Wood via GitGitGadget
2021-08-20 15:40   ` [PATCH v2 2/4] rebase -i: Add another reword test Phillip Wood via GitGitGadget
2021-08-20 15:40   ` [PATCH v2 3/4] rebase -r: don't write .git/MERGE_MSG when fast-forwarding Phillip Wood via GitGitGadget
2021-08-20 15:40   ` [PATCH v2 4/4] rebase -r: fix merge -c with a merge strategy Phillip Wood via GitGitGadget
2021-08-24 13:33   ` [PATCH v2 0/4] rebase -r: some merge related fixes 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=f2a2e3531a181f68cee43f832045633aee519fb8.1628860053.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=szeder.dev@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).