Skip to content

Commit bc4efaf

Browse files
committed
Merge branch 'js/fix-merge-arg-quoting-in-rebase-p'
"git rebase -p -X<option>" did not propagate the option properly down to underlying merge strategy backend. * js/fix-merge-arg-quoting-in-rebase-p: rebase -p: fix quoting when calling `git merge`
2 parents 6366dd9 + dd6fb00 commit bc4efaf

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

git-rebase--interactive.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,12 @@ pick_one_preserving_merges () {
392392
new_parents=${new_parents# $first_parent}
393393
merge_args="--no-log --no-ff"
394394
if ! do_with_author output eval \
395-
'git merge ${gpg_sign_opt:+"$gpg_sign_opt"} \
396-
$allow_rerere_autoupdate $merge_args \
397-
$strategy_args -m "$msg_content" $new_parents'
395+
git merge ${gpg_sign_opt:+$(git rev-parse \
396+
--sq-quote "$gpg_sign_opt")} \
397+
$allow_rerere_autoupdate "$merge_args" \
398+
"$strategy_args" \
399+
-m $(git rev-parse --sq-quote "$msg_content") \
400+
"$new_parents"
398401
then
399402
printf "%s\n" "$msg_content" > "$GIT_DIR"/MERGE_MSG
400403
die_with_patch $sha1 "$(eval_gettext "Error redoing merge \$sha1")"

t/t3418-rebase-continue.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,20 @@ test_expect_success 'rebase --continue remembers merge strategy and options' '
7474
test -f funny.was.run
7575
'
7676

77+
test_expect_success 'rebase passes merge strategy options correctly' '
78+
rm -fr .git/rebase-* &&
79+
git reset --hard commit-new-file-F3-on-topic-branch &&
80+
test_commit theirs-to-merge &&
81+
git reset --hard HEAD^ &&
82+
test_commit some-commit &&
83+
test_tick &&
84+
git merge --no-ff theirs-to-merge &&
85+
FAKE_LINES="1 edit 2 3" git rebase -i -f -p -m \
86+
-s recursive --strategy-option=theirs HEAD~2 &&
87+
test_commit force-change &&
88+
git rebase --continue
89+
'
90+
7791
test_expect_success 'setup rerere database' '
7892
rm -fr .git/rebase-* &&
7993
git reset --hard commit-new-file-F3-on-topic-branch &&

0 commit comments

Comments
 (0)