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>
Jonathan Nieder committed
Aug 17, 2010 at 02:11 UTC
2a70fa4f1e377bc68bcabdc1a550e9970acccda7
1 file changed
+10
-2
contrib/examples/git-merge.sh
+10
-2
@@ -52,7 +52,7 @@ squash= no_commit= log_arg=
52
53
dropsave() {
54
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
56
}
57
58
savestate() {
@@ -585,7 +585,15 @@ else
585
do
586
echo $remote
587
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"
597
fi
598
599
if test "$merge_was_ok" = t