Do not ignore merge options in interactive rebase

Merge strategy and its options can be specified in `git rebase`, but with `--interactive`, they were completely ignored. Signed-off-by: Arnaud Fontaine <arnau@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Arnaud Fontaine committed Jul 2, 2013 at 17:05 UTC db2b3b820e2b28da268cc88adff076b396392dfe
2 files changed +27 -5
git-rebase--interactive.sh
+16 -5
@@ -80,6 +80,18 @@ amend="$state_dir"/amend
80 rewritten_list="$state_dir"/rewritten-list
81 rewritten_pending="$state_dir"/rewritten-pending
82
83 +strategy_args=
84 +if test -n "$do_merge"
85 +then
86 + strategy_args=${strategy:+--strategy=$strategy}
87 + eval '
88 + for strategy_opt in '"$strategy_opts"'
89 + do
90 + strategy_args="$strategy_args -X$(git rev-parse --sq-quote "${strategy_opt#--}")"
91 + done
92 + '
93 +fi
94 +
95 GIT_CHERRY_PICK_HELP="$resolvemsg"
96 export GIT_CHERRY_PICK_HELP
97
@@ -239,7 +251,7 @@ pick_one () {
251
252 test -d "$rewritten" &&
253 pick_one_preserving_merges "$@" && return
242 - output git cherry-pick $empty_args $ff "$@"
254 + output eval git cherry-pick "$strategy_args" $empty_args $ff "$@"
255 }
256
257 pick_one_preserving_merges () {
@@ -340,9 +352,8 @@ pick_one_preserving_merges () {
352 msg_content="$(commit_message $sha1)"
353 # No point in merging the first parent, that's HEAD
354 new_parents=${new_parents# $first_parent}
343 - if ! do_with_author output \
344 - git merge --no-ff ${strategy:+-s $strategy} -m \
345 - "$msg_content" $new_parents
355 + if ! do_with_author output eval \
356 + 'git merge --no-ff $strategy_args -m "$msg_content" $new_parents'
357 then
358 printf "%s\n" "$msg_content" > "$GIT_DIR"/MERGE_MSG
359 die_with_patch $sha1 "Error redoing merge $sha1"
@@ -350,7 +361,7 @@ pick_one_preserving_merges () {
361 echo "$sha1 $(git rev-parse HEAD^0)" >> "$rewritten_list"
362 ;;
363 *)
353 - output git cherry-pick "$@" ||
364 + output eval git cherry-pick "$strategy_args" "$@" ||
365 die_with_patch $sha1 "Could not pick $sha1"
366 ;;
367 esac
t/t3404-rebase-interactive.sh
+11
@@ -950,4 +950,15 @@ test_expect_success 'rebase -i, with <onto> and <upstream> specified as :/quuxer
950 git checkout branch1
951 '
952
953 +test_expect_success 'rebase -i with --strategy and -X' '
954 + git checkout -b conflict-merge-use-theirs conflict-branch &&
955 + git reset --hard HEAD^ &&
956 + echo five >conflict &&
957 + echo Z >file1 &&
958 + git commit -a -m "one file conflict" &&
959 + EDITOR=true git rebase -i --strategy=recursive -Xours conflict-branch &&
960 + test $(git show conflict-branch:conflict) = $(cat conflict) &&
961 + test $(cat file1) = Z
962 +'
963 +
964 test_done