Skip to content

Commit 2a70fa4

Browse files
jrngitster
authored andcommitted
merge script: handle --no-ff --no-commit correctly
In a --no-ff merge with conflicts, "git commit" used to forget the --no-ff when used to complete the merge. That was fixed by v1.6.1-rc1~134^2 (builtin-commit: use reduce_heads() only when appropriate, 2008-10-03) for the builtin merge. Port the change to the merge script in contrib/examples. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent f07df52 commit 2a70fa4

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

contrib/examples/git-merge.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ squash= no_commit= log_arg=
5252

5353
dropsave() {
5454
rm -f -- "$GIT_DIR/MERGE_HEAD" "$GIT_DIR/MERGE_MSG" \
55-
"$GIT_DIR/MERGE_STASH" || exit 1
55+
"$GIT_DIR/MERGE_STASH" "$GIT_DIR/MERGE_MODE" || exit 1
5656
}
5757

5858
savestate() {
@@ -585,7 +585,15 @@ else
585585
do
586586
echo $remote
587587
done >"$GIT_DIR/MERGE_HEAD"
588-
printf '%s\n' "$merge_msg" >"$GIT_DIR/MERGE_MSG"
588+
printf '%s\n' "$merge_msg" >"$GIT_DIR/MERGE_MSG" ||
589+
die "Could not write to $GIT_DIR/MERGE_MSG"
590+
if test "$allow_fast_forward" != t
591+
then
592+
printf "%s" no-ff
593+
else
594+
:
595+
fi >"$GIT_DIR/MERGE_MODE" ||
596+
die "Could not write to $GIT_DIR/MERGE_MODE"
589597
fi
590598

591599
if test "$merge_was_ok" = t

0 commit comments

Comments
 (0)