It's also okay if an expected tree object is actually a commit.
authorAvery Pennarun <apenwarr@gmail.com>
Tue, 1 Mar 2011 00:49:42 +0000 (16:49 -0800)
committerAvery Pennarun <apenwarr@gmail.com>
Tue, 1 Mar 2011 00:49:42 +0000 (16:49 -0800)
...that happens with submodules sometimes, so don't panic.

Reported by Sum-Wai Low.

git-subtree.sh
index cf50de150cf4796eea87bfb6341bb3ddc1372535..fa4e3e3661d4b0d092c35e019b160d1e4d4080c2 100755 (executable)
@@ -397,7 +397,7 @@ subtree_for_commit()
        git ls-tree "$commit" -- "$dir" |
        while read mode type tree name; do
                assert [ "$name" = "$dir" ]
-               assert [ "$type" = "tree" ]
+               assert [ "$type" = "tree" -o "$type" = "commit" ]
                echo $tree
                break
        done