* [PATCH] rebase -i: Remember merge options beyond continue actions
@ 2014-06-10 0:02 Fabian Ruch
2014-06-10 0:17 ` Eric Sunshine
0 siblings, 1 reply; 8+ messages in thread
From: Fabian Ruch @ 2014-06-10 0:02 UTC (permalink / raw)
To: git
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] rebase -i: Remember merge options beyond continue actions
2014-06-10 0:02 [PATCH] rebase -i: Remember merge options beyond continue actions Fabian Ruch
@ 2014-06-10 0:17 ` Eric Sunshine
2014-06-10 0:37 ` Fabian Ruch
0 siblings, 1 reply; 8+ messages in thread
From: Eric Sunshine @ 2014-06-10 0:17 UTC (permalink / raw)
To: Fabian Ruch; +Cc: Git List, Diogo de Campos
On Mon, Jun 9, 2014 at 8:02 PM, Fabian Ruch <bafain@gmail.com> wrote:
> If the user explicitly specified a merge strategy or strategy options,
> "rebase --interactive" started using the default merge strategy again
> after "rebase --continue".
For reference, this problem was reported as far back as 2013-08-09 [1].
[1]: http://article.gmane.org/gmane.comp.version-control.git/232013
> 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".
Missing sign-off.
> ---
> 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] rebase -i: Remember merge options beyond continue actions
2014-06-10 0:17 ` Eric Sunshine
@ 2014-06-10 0:37 ` Fabian Ruch
2014-06-11 21:13 ` Michael Haggerty
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Fabian Ruch @ 2014-06-10 0:37 UTC (permalink / raw)
To: Eric Sunshine; +Cc: git, Diogo de Campos
Hi Eric,
thanks a lot for the reference.
I added the Reported-by: and Signed-off-by: lines to the commit message.
Fabian
-- >8 --
Subject: rebase -i: Remember merge options beyond continue actions
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".
Reported-by: Diogo de Campos <campos@esss.com.br>
Signed-off-by: Fabian Ruch <bafain@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] rebase -i: Remember merge options beyond continue actions
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
2 siblings, 0 replies; 8+ messages in thread
From: Michael Haggerty @ 2014-06-11 21:13 UTC (permalink / raw)
To: Fabian Ruch, Eric Sunshine; +Cc: git, Diogo de Campos
The fix seems reasonable to me. See below for a couple of suggestions
regarding the commit message.
On 06/10/2014 02:37 AM, Fabian Ruch wrote:
> [...]
> -- >8 --
> Subject: rebase -i: Remember merge options beyond continue actions
>
> 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.
Please phrase commit messages in the imperative voice, as if commanding
git to fix itself. Maybe
If the user explicitly specified a merge strategy or strategy
options, continue to use that strategy/option after
"rebase --continue". Add a test of the corrected behavior.
> 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".
>
> Reported-by: Diogo de Campos <campos@esss.com.br>
> Signed-off-by: Fabian Ruch <bafain@gmail.com>
I expect it took you a while to figure out how the strategy-related
options are handled and propagated from one step of an interactive
rebase to the next and why your fix is correct. It certainly took *me*
a while even though I had your patch in front of me :-)
It is helpful if you give reviewers and future readers the benefit of
your hard work by spoon-feeding them more of the backstory. I suggest
expanding your justification to something like this (correct me if I've
misunderstood something!):
If --merge is specified or implied by -s or -X, then "strategy" and
"strategy_opts" are set to values from which "strategy_args" can be
derived; otherwise they are set to empty strings. Either way,
their values are propagated from one step of an interactive rebase
to the next via state files.
"do_merge", on the other hand, is *not* propagated to later steps of
an interactive rebase. Therefore, making the initialization of
"strategy_args" conditional on "do_merge" being set prevents later
steps of an interactive rebase from setting it correctly.
Luckily, we don't need the "do_merge" guard at all. If the rebase
was started without --merge, then "strategy" and "strategy_opts"
are both the empty string, which results in "strategy_args" also
being set to the empty string, which is just what we want in that
situation. So remove the "do_merge" guard and derive
"strategy_args" from "strategy" and "strategy_opts" every time.
Michael
> ---
> 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" &&
>
--
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] rebase -i: Remember merge options beyond continue actions
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
2 siblings, 0 replies; 8+ messages in thread
From: Ralf Thielow @ 2014-07-18 17:03 UTC (permalink / raw)
To: git; +Cc: bafain, gitster, mhagger, Ralf Thielow
Hi,
Thanks for the patch. I've had this issue today
and the patch has fixed it. I hope the patch makes
its way to Git.
Ralf
> Hi Eric,
>
> thanks a lot for the reference.
>
> I added the Reported-by: and Signed-off-by: lines to the commit message.
>
> Fabian
>
> -- >8 --
> Subject: rebase -i: Remember merge options beyond continue actions
>
> 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".
...
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] rebase -i: remember merge options beyond continue actions
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 ` Ralf Thielow
2015-12-11 20:07 ` Junio C Hamano
2 siblings, 1 reply; 8+ messages in thread
From: Ralf Thielow @ 2015-12-11 19:54 UTC (permalink / raw)
To: git; +Cc: bafain, campos, mhagger, sunshine, Ralf Thielow
From: Fabian Ruch <bafain@gmail.com>
If the user specifies a merge strategy or strategy options in
"rebase --interactive", also use these in subsequent calls of
"rebase --continue".
In the implementation, the "do_merge" guard to check for a given
merge strategy or strategy options is implied by passing these
options, but not stored. This prevents subsequent calls of
"rebase --continue" to use this setting again later. Remove this
"do_merge" guard to allow a later usage.
Reported-by: Diogo de Campos <campos@esss.com.br>
Signed-off-by: Fabian Ruch <bafain@gmail.com>
Helped-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
---
I've been applying the original patch for a long time to my tree,
as it helps me to resolve conflicts e.g. when rebasing .po files.
I also think it's a reasonable change for git-rebase.
I've rebased it agains the current master and rewrote the
commit message to try to make this change technically a bit more
easy to understand.
Original patch submit:
http://thread.gmane.org/gmane.comp.version-control.git/251147/
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 b938a6d..c0cfe88 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -81,17 +81,13 @@ rewritten_pending="$state_dir"/rewritten-pending
# and leaves CR at the end instead.
cr=$(printf "\015")
-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 98eb49a..9a2461c 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -1006,6 +1006,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.7.0.rc0.174.g1b62464
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] rebase -i: remember merge options beyond continue actions
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
0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2015-12-11 20:07 UTC (permalink / raw)
To: Ralf Thielow
Cc: Git Mailing List, bafain, campos, Michael Haggerty, Eric Sunshine
On Fri, Dec 11, 2015 at 11:54 AM, Ralf Thielow <ralf.thielow@gmail.com> wrote:
> From: Fabian Ruch <bafain@gmail.com>
>
> If the user specifies a merge strategy or strategy options in
> "rebase --interactive", also use these in subsequent calls of
> "rebase --continue".
>
> In the implementation, the "do_merge" guard to check for a given
> merge strategy or strategy options is implied by passing these
> options, but not stored. This prevents subsequent calls of
> "rebase --continue" to use this setting again later. Remove this
> "do_merge" guard to allow a later usage.
>
> Reported-by: Diogo de Campos <campos@esss.com.br>
> Signed-off-by: Fabian Ruch <bafain@gmail.com>
> Helped-by: Michael Haggerty <mhagger@alum.mit.edu>
> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
> ---
> I've been applying the original patch for a long time to my tree,
> as it helps me to resolve conflicts e.g. when rebasing .po files.
> I also think it's a reasonable change for git-rebase.
>
> I've rebased it agains the current master and rewrote the
> commit message to try to make this change technically a bit more
> easy to understand.
Thanks. I wonder if Michael's rephrasing in $gmane/251386 still applies, which
I found by far the most readable.
http://thread.gmane.org/gmane.comp.version-control.git/251147/focus=251386
>
> Original patch submit:
> http://thread.gmane.org/gmane.comp.version-control.git/251147/
>
> 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 b938a6d..c0cfe88 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -81,17 +81,13 @@ rewritten_pending="$state_dir"/rewritten-pending
> # and leaves CR at the end instead.
> cr=$(printf "\015")
>
> -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 98eb49a..9a2461c 100755
> --- a/t/t3404-rebase-interactive.sh
> +++ b/t/t3404-rebase-interactive.sh
> @@ -1006,6 +1006,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.7.0.rc0.174.g1b62464
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] rebase -i: remember merge options beyond continue actions
2015-12-11 20:07 ` Junio C Hamano
@ 2015-12-11 20:30 ` Ralf Thielow
0 siblings, 0 replies; 8+ messages in thread
From: Ralf Thielow @ 2015-12-11 20:30 UTC (permalink / raw)
To: gitster, git; +Cc: bafain, campos, mhagger, sunshine, Ralf Thielow
From: Fabian Ruch <bafain@gmail.com>
If the user explicitly specified a merge strategy or strategy
options, continue to use that strategy/option after
"rebase --continue". Add a test of the corrected behavior.
If --merge is specified or implied by -s or -X, then "strategy and
"strategy_opts" are set to values from which "strategy_args" can be
derived; otherwise they are set to empty strings. Either way,
their values are propagated from one step of an interactive rebase
to the next via state files.
"do_merge", on the other hand, is *not* propagated to later steps of
an interactive rebase. Therefore, making the initialization of
"strategy_args" conditional on "do_merge" being set prevents later
steps of an interactive rebase from setting it correctly.
Luckily, we don't need the "do_merge" guard at all. If the rebase
was started without --merge, then "strategy" and "strategy_opts"
are both the empty string, which results in "strategy_args" also
being set to the empty string, which is just what we want in that
situation. So remove the "do_merge" guard and derive
"strategy_args" from "strategy" and "strategy_opts" every time.
Reported-by: Diogo de Campos <campos@esss.com.br>
Signed-off-by: Fabian Ruch <bafain@gmail.com>
Helped-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
---
2015-12-11 21:07 GMT+01:00 Junio C Hamano <gitster@pobox.com>:
> On Fri, Dec 11, 2015 at 11:54 AM, Ralf Thielow <ralf.thielow@gmail.com> wrote:
>
> Thanks. I wonder if Michael's rephrasing in $gmane/251386 still applies, which
> I found by far the most readable.
>
> http://thread.gmane.org/gmane.comp.version-control.git/251147/focus=251386
>
Sure.
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 b938a6d..c0cfe88 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -81,17 +81,13 @@ rewritten_pending="$state_dir"/rewritten-pending
# and leaves CR at the end instead.
cr=$(printf "\015")
-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 98eb49a..9a2461c 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -1006,6 +1006,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.7.0.rc0.174.g1b62464
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-12-11 20:30 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-10 0:02 [PATCH] rebase -i: Remember merge options beyond continue actions Fabian Ruch
2014-06-10 0:17 ` 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
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).