All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabian Ruch <bafain@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH] rebase -i: Remember merge options beyond continue actions
Date: Tue, 10 Jun 2014 02:02:58 +0200	[thread overview]
Message-ID: <53964B32.2090804@gmail.com> (raw)

If the user explicitly specified a merge strategy or strategy options,
"rebase --interactive" started using the default merge strategy again
after "rebase --continue".

This problem gets fixed by this commit. Add test.

Since the "rebase" options "-s" and "-X" imply "--merge", we can simply
remove the "do_merge" guard in the interactive mode and always compile
the "cherry-pick" arguments from the "rebase" state variables "strategy"
and "strategy_opts".
---
 git-rebase--interactive.sh    | 18 +++++++-----------
 t/t3404-rebase-interactive.sh | 16 ++++++++++++++++
 2 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 6ec9d3c..817c933 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -77,17 +77,13 @@ amend="$state_dir"/amend
 rewritten_list="$state_dir"/rewritten-list
 rewritten_pending="$state_dir"/rewritten-pending
 
-strategy_args=
-if test -n "$do_merge"
-then
-	strategy_args=${strategy:+--strategy=$strategy}
-	eval '
-		for strategy_opt in '"$strategy_opts"'
-		do
-			strategy_args="$strategy_args -X$(git rev-parse --sq-quote "${strategy_opt#--}")"
-		done
-	'
-fi
+strategy_args=${strategy:+--strategy=$strategy}
+eval '
+	for strategy_opt in '"$strategy_opts"'
+	do
+		strategy_args="$strategy_args -X$(git rev-parse --sq-quote "${strategy_opt#--}")"
+	done
+'
 
 GIT_CHERRY_PICK_HELP="$resolvemsg"
 export GIT_CHERRY_PICK_HELP
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index c0023a5..73849f1 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -998,6 +998,22 @@ test_expect_success 'rebase -i with --strategy and -X' '
 	test $(cat file1) = Z
 '
 
+test_expect_success 'interrupted rebase -i with --strategy and -X' '
+	git checkout -b conflict-merge-use-theirs-interrupted conflict-branch &&
+	git reset --hard HEAD^ &&
+	>breakpoint &&
+	git add breakpoint &&
+	git commit -m "breakpoint for interactive mode" &&
+	echo five >conflict &&
+	echo Z >file1 &&
+	git commit -a -m "one file conflict" &&
+	set_fake_editor &&
+	FAKE_LINES="edit 1 2" git rebase -i --strategy=recursive -Xours conflict-branch &&
+	git rebase --continue &&
+	test $(git show conflict-branch:conflict) = $(cat conflict) &&
+	test $(cat file1) = Z
+'
+
 test_expect_success 'rebase -i error on commits with \ in message' '
 	current_head=$(git rev-parse HEAD)
 	test_when_finished "git rebase --abort; git reset --hard $current_head; rm -f error" &&
-- 
2.0.0

             reply	other threads:[~2014-06-10  0:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-10  0:02 Fabian Ruch [this message]
2014-06-10  0:17 ` [PATCH] rebase -i: Remember merge options beyond continue actions Eric Sunshine
2014-06-10  0:37   ` Fabian Ruch
2014-06-11 21:13     ` Michael Haggerty
2014-07-18 17:03     ` Ralf Thielow
2015-12-11 19:54     ` [PATCH] rebase -i: remember " Ralf Thielow
2015-12-11 20:07       ` Junio C Hamano
2015-12-11 20:30         ` [PATCH v2] " Ralf Thielow

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=53964B32.2090804@gmail.com \
    --to=bafain@gmail.com \
    --cc=git@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.