aboutsummaryrefslogtreecommitdiff
path: root/contrib/subtree/git-subtree.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-02-03 14:16:03 -0800
committerJunio C Hamano <gitster@pobox.com>2016-02-03 14:16:03 -0800
commitdd65a9e5e3b6298e4fa52e21680008e7fd5556ea (patch)
treead06b92e0951d01a9bb5dc7085638d80420f29a0 /contrib/subtree/git-subtree.sh
parentcc329f65a34911999cfbb68bd83c6a54b93e461c (diff)
parent933cfeb90b5d03b4096db6d60494a6eedea25d03 (diff)
downloadgit-dd65a9e5e3b6298e4fa52e21680008e7fd5556ea.tar.gz
git-dd65a9e5e3b6298e4fa52e21680008e7fd5556ea.tar.xz
Merge branch 'dw/subtree-split-do-not-drop-merge'
The "split" subcommand of "git subtree" (in contrib/) incorrectly skipped merges when it shouldn't, which was corrected. * dw/subtree-split-do-not-drop-merge: contrib/subtree: fix "subtree split" skipped-merge bug
Diffstat (limited to 'contrib/subtree/git-subtree.sh')
-rwxr-xr-xcontrib/subtree/git-subtree.sh12
1 files changed, 10 insertions, 2 deletions
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index efbdb720e..7a39b30ad 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -485,8 +485,16 @@ copy_or_skip()
p="$p -p $parent"
fi
done
-
- if [ -n "$identical" ]; then
+
+ copycommit=
+ if [ -n "$identical" ] && [ -n "$nonidentical" ]; then
+ extras=$(git rev-list --count $identical..$nonidentical)
+ if [ "$extras" -ne 0 ]; then
+ # we need to preserve history along the other branch
+ copycommit=1
+ fi
+ fi
+ if [ -n "$identical" ] && [ -z "$copycommit" ]; then
echo $identical
else
copy_commit $rev $tree "$p" || exit $?