fix submodule lookup in bare repos
authorkst <nil@krj.st>
Wed, 5 Aug 2020 22:11:18 +0000 (22:11 +0000)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Thu, 6 Aug 2020 16:25:27 +0000 (18:25 +0200)
commit174a763058f9a90831ab5a2aeb1c9bfbecdabf48
tree641e9989acb9afb379a1dc872593d745faaeff3f
parentf05e6b0fcb3b874180970d06ebcde05fb5aea470
fix submodule lookup in bare repos

git_submodule_lookup does not work without a working tree [1], so the
current approach fails to recognize any submodules in bare repos.

Instead, notice that

$ git ls-tree HEAD

lists any submodules as commit objects regardless of a working tree.
This is the only instance commit object is used in a tree, so we will
use this to check for submodules.

[1]: https://github.com/libgit2/libgit2/pull/4305/files
stagit.c