From: Junio C Hamano Date: Wed, 3 Feb 2016 22:16:03 +0000 (-0800) Subject: Merge branch 'dw/subtree-split-do-not-drop-merge' X-Git-Tag: v2.8.0-rc0~78 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/dd65a9e5e3b6298e4fa52e21680008e7fd5556ea?ds=inline;hp=-c 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 --- dd65a9e5e3b6298e4fa52e21680008e7fd5556ea diff --combined contrib/subtree/git-subtree.sh index efbdb720e6,5c8372709b..7a39b30ad0 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@@ -245,10 -245,7 +245,10 @@@ find_latest_squash( case "$a" in START) sq="$b" ;; git-subtree-mainline:) main="$b" ;; - git-subtree-split:) sub="$b" ;; + git-subtree-split:) + sub="$(git rev-parse "$b^0")" || + die "could not rev-parse split hash $b from commit $sq" + ;; END) if [ -n "$sub" ]; then if [ -n "$main" ]; then @@@ -281,10 -278,7 +281,10 @@@ find_existing_splits( case "$a" in START) sq="$b" ;; git-subtree-mainline:) main="$b" ;; - git-subtree-split:) sub="$b" ;; + git-subtree-split:) + sub="$(git rev-parse "$b^0")" || + die "could not rev-parse split hash $b from commit $sq" + ;; END) debug " Main is: '$main'" if [ -z "$main" -a -n "$sub" ]; then @@@ -485,8 -479,16 +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 $?