Skip commit objects that should be trees, rather than copying them.
authorAvery Pennarun <apenwarr@gmail.com>
Tue, 1 Mar 2011 04:48:50 +0000 (20:48 -0800)
committerAvery Pennarun <apenwarr@gmail.com>
Tue, 1 Mar 2011 04:48:50 +0000 (20:48 -0800)
An improvement on the previous patch, based on more reports from Sum-Wai
Low.

git-subtree.sh
index fa4e3e3661d4b0d092c35e019b160d1e4d4080c2..920c664bb7c7a4e1aa455479e2caef3d6c6dc786 100755 (executable)
@@ -398,6 +398,7 @@ subtree_for_commit()
        while read mode type tree name; do
                assert [ "$name" = "$dir" ]
                assert [ "$type" = "tree" -o "$type" = "commit" ]
+               [ "$type" = "commit" ] && continue  # ignore submodules
                echo $tree
                break
        done