rebase -p: fix quoting when calling git merge
It has been reported that strategy arguments are not passed to `git merge` correctly when rebasing interactively, preserving merges. The reason is that the strategy arguments are already quoted, and then quoted again. This fixes https://github.com/git-for-windows/git/issues/1321 Original-patch-by: Kim Gybels <kgybels@infogroep.be> Also-reported-by: Matwey V. Kornilov <matwey.kornilov@gmail.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
3013dff866
commit
dd6fb0053c
@ -392,9 +392,12 @@ pick_one_preserving_merges () {
|
|||||||
new_parents=${new_parents# $first_parent}
|
new_parents=${new_parents# $first_parent}
|
||||||
merge_args="--no-log --no-ff"
|
merge_args="--no-log --no-ff"
|
||||||
if ! do_with_author output eval \
|
if ! do_with_author output eval \
|
||||||
'git merge ${gpg_sign_opt:+"$gpg_sign_opt"} \
|
git merge ${gpg_sign_opt:+$(git rev-parse \
|
||||||
$allow_rerere_autoupdate $merge_args \
|
--sq-quote "$gpg_sign_opt")} \
|
||||||
$strategy_args -m "$msg_content" $new_parents'
|
$allow_rerere_autoupdate "$merge_args" \
|
||||||
|
"$strategy_args" \
|
||||||
|
-m $(git rev-parse --sq-quote "$msg_content") \
|
||||||
|
"$new_parents"
|
||||||
then
|
then
|
||||||
printf "%s\n" "$msg_content" > "$GIT_DIR"/MERGE_MSG
|
printf "%s\n" "$msg_content" > "$GIT_DIR"/MERGE_MSG
|
||||||
die_with_patch $sha1 "$(eval_gettext "Error redoing merge \$sha1")"
|
die_with_patch $sha1 "$(eval_gettext "Error redoing merge \$sha1")"
|
||||||
|
@ -74,6 +74,20 @@ test_expect_success 'rebase --continue remembers merge strategy and options' '
|
|||||||
test -f funny.was.run
|
test -f funny.was.run
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'rebase passes merge strategy options correctly' '
|
||||||
|
rm -fr .git/rebase-* &&
|
||||||
|
git reset --hard commit-new-file-F3-on-topic-branch &&
|
||||||
|
test_commit theirs-to-merge &&
|
||||||
|
git reset --hard HEAD^ &&
|
||||||
|
test_commit some-commit &&
|
||||||
|
test_tick &&
|
||||||
|
git merge --no-ff theirs-to-merge &&
|
||||||
|
FAKE_LINES="1 edit 2 3" git rebase -i -f -p -m \
|
||||||
|
-s recursive --strategy-option=theirs HEAD~2 &&
|
||||||
|
test_commit force-change &&
|
||||||
|
git rebase --continue
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'setup rerere database' '
|
test_expect_success 'setup rerere database' '
|
||||||
rm -fr .git/rebase-* &&
|
rm -fr .git/rebase-* &&
|
||||||
git reset --hard commit-new-file-F3-on-topic-branch &&
|
git reset --hard commit-new-file-F3-on-topic-branch &&
|
||||||
|
Loading…
Reference in New Issue
Block a user