Skip to content

Commit fbf8ac2

Browse files
author
Junio C Hamano
committed
git-merge: make recursive the default strategy
git-pull invoked merge with recursive as the default strategy for some time now; match it in the git-merge itself. Also avoid listing more than one strategy on default because we have only one strategy that can resolve an octopus and we are already counting heads here. This reduces the need to stash away local modifications. Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent b99a394 commit fbf8ac2

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

git-merge.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ usage () {
1212
die "git-merge [-n] [--no-commit] [-s <strategy>]... <merge-message> <head> <remote>+"
1313
}
1414

15-
# all_strategies='resolve recursive stupid octopus'
16-
1715
all_strategies='recursive octopus resolve stupid ours'
18-
default_strategies='resolve octopus'
16+
default_strategies='recursive'
1917
use_strategies=
2018

2119
dropsave() {
@@ -90,11 +88,6 @@ do
9088
shift
9189
done
9290

93-
case "$use_strategies" in
94-
'')
95-
use_strategies=$default_strategies
96-
;;
97-
esac
9891
test "$#" -le 2 && usage ;# we need at least two heads.
9992

10093
merge_msg="$1"
@@ -185,6 +178,17 @@ case "$#,$common,$no_commit" in
185178
;;
186179
esac
187180

181+
case "$use_strategies" in
182+
'')
183+
case "$#" in
184+
1)
185+
use_strategies="$default_strategies" ;;
186+
*)
187+
use_strategies=octopus ;;
188+
esac
189+
;;
190+
esac
191+
188192
# At this point, we need a real merge. No matter what strategy
189193
# we use, it would operate on the index, possibly affecting the
190194
# working tree, and when resolved cleanly, have the desired tree

0 commit comments

Comments
 (0)