rebase -p: fix incorrect commit message when calling `git merge`.

Since commit dd6fb0053 ("rebase -p: fix quoting when calling `git merge`"), commit message of the merge commit being rebased is passed to the merge command using a subshell executing 'git rev-parse --sq-quote'. Double quotes are needed around this subshell so that, newlines are kept for the git merge command. Before this patch, following merge message: "Merge mybranch into mynewbranch Awesome commit." becomes: "Merge mybranch into mynewbranch Awesome commit." after a rebase -p. Fixes: "dd6fb0053 rebase -p: fix quoting when calling `git merge`" Reported-by: Jamie Iles <jamie.iles@oracle.com> Suggested-by: Vegard Nossum <vegard.nossum@oracle.com> Suggested-by: Quentin Casasnovas <quentin.casasnovas@oracle.com> Signed-off-by: Gregory Herrero <gregory.herrero@oracle.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Gregory Herrero committed Feb 8, 2018 at 21:42 UTC ed5144d7eb63a0e0e71d3b281e69e953abbf0365
2 files changed +26 -2
git-rebase--interactive.sh
+1 -1
@@ -396,7 +396,7 @@ pick_one_preserving_merges () {
396 --sq-quote "$gpg_sign_opt")} \
397 $allow_rerere_autoupdate "$merge_args" \
398 "$strategy_args" \
399 - -m $(git rev-parse --sq-quote "$msg_content") \
399 + -m "$(git rev-parse --sq-quote "$msg_content")" \
400 "$new_parents"
401 then
402 printf "%s\n" "$msg_content" > "$GIT_DIR"/MERGE_MSG
t/t3408-rebase-multi-line.sh
+25 -1
@@ -24,8 +24,23 @@ But otherwise with a sane description." &&
24 >elif &&
25 git add elif &&
26 test_tick &&
27 - git commit -m second
27 + git commit -m second &&
28
29 + git checkout -b side2 &&
30 + >afile &&
31 + git add afile &&
32 + test_tick &&
33 + git commit -m third &&
34 + echo hello >afile &&
35 + test_tick &&
36 + git commit -a -m fourth &&
37 + git checkout -b side-merge &&
38 + git reset --hard HEAD^^ &&
39 + git merge --no-ff -m "A merge commit log message that has a long
40 +summary that spills over multiple lines.
41 +
42 +But otherwise with a sane description." side2 &&
43 + git branch side-merge-original
44 '
45
46 test_expect_success rebase '
@@ -36,6 +51,15 @@ test_expect_success rebase '
51 git cat-file commit side@{1} | sed -e "1,/^\$/d" >expect &&
52 test_cmp expect actual
53
54 +'
55 +test_expect_success rebasep '
56 +
57 + git checkout side-merge &&
58 + git rebase -p side &&
59 + git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
60 + git cat-file commit side-merge-original | sed -e "1,/^\$/d" >expect &&
61 + test_cmp expect actual
62 +
63 '
64
65 test_done