rebase --preserve-merges: ignore "merge.log" config

When "merge.log" config is set, "rebase --preserve-merges" will add the log lines to the message of the rebased merge commit. A rebase should not modify a commit message automatically. Teach "git-rebase" to ignore that configuration by passing "--no-log" to the git-merge call. Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ralf Thielow committed Aug 21, 2013 at 20:48 UTC a9f739c111898ed879bc077fb3a2f71b9766bba7
2 files changed +25 -1
git-rebase--interactive.sh
+2 -1
@@ -352,8 +352,9 @@ 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}
355 + merge_args="--no-log --no-ff"
356 if ! do_with_author output eval \
356 - 'git merge --no-ff $strategy_args -m "$msg_content" $new_parents'
357 + 'git merge $merge_args $strategy_args -m "$msg_content" $new_parents'
358 then
359 printf "%s\n" "$msg_content" > "$GIT_DIR"/MERGE_MSG
360 die_with_patch $sha1 "Error redoing merge $sha1"
t/t3409-rebase-preserve-merges.sh
+23
@@ -28,6 +28,8 @@ export GIT_AUTHOR_EMAIL
28 # \--A3 <-- topic2
29 # \
30 # B2 <-- origin/topic
31 +#
32 +# Clone 4 (same as Clone 3)
33
34 test_expect_success 'setup for merge-preserving rebase' \
35 'echo First > A &&
@@ -64,6 +66,16 @@ test_expect_success 'setup for merge-preserving rebase' \
66 git merge --no-ff topic2
67 ) &&
68
69 + git clone ./. clone4 &&
70 + (
71 + cd clone4 &&
72 + git checkout -b topic2 origin/topic &&
73 + echo Sixth > A &&
74 + git commit -a -m "Modify A3" &&
75 + git checkout -b topic origin/topic &&
76 + git merge --no-ff topic2
77 + ) &&
78 +
79 git checkout topic &&
80 echo Fourth >> B &&
81 git commit -a -m "Modify B2"
@@ -96,4 +108,15 @@ test_expect_success 'rebase -p preserves no-ff merges' '
108 )
109 '
110
111 +test_expect_success 'rebase -p ignores merge.log config' '
112 + (
113 + cd clone4 &&
114 + git fetch &&
115 + git -c merge.log=1 rebase -p origin/topic &&
116 + echo >expected &&
117 + git log --format="%b" -1 >current &&
118 + test_cmp expected current
119 + )
120 +'
121 +
122 test_done