From 448e71e2637e0d7546fb0a2b386e74bc7aa93be8 Mon Sep 17 00:00:00 2001 From: Pelle Wessman Date: Fri, 7 May 2010 21:21:25 +0200 Subject: [PATCH] Use 'git merge -Xsubtree' when git version >= 1.7.0. It's possible to specify the subdir of a subtree since Git 1.7.0 - adding support for that functionality to make the merge more stable. Also checking for git version - now only uses the new subtree subdir option when on at least 1.7. --- git-subtree.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/git-subtree.sh b/git-subtree.sh index 501c6dc2f..b7c350107 100755 --- a/git-subtree.sh +++ b/git-subtree.sh @@ -634,11 +634,20 @@ cmd_merge() debug "New squash commit: $new" rev="$new" fi - - if [ -n "$message" ]; then - git merge -s subtree --message="$message" $rev + + version=$(git version) + if [ "$version" \< "git version 1.7" ]; then + if [ -n "$message" ]; then + git merge -s subtree --message="$message" $rev + else + git merge -s subtree $rev + fi else - git merge -s subtree $rev + if [ -n "$message" ]; then + git merge -Xsubtree="$prefix" --message="$message" $rev + else + git merge -Xsubtree="$prefix" $rev + fi fi } -- 2.26.2