Re: How can I tell if a SHA1 is a submodule reference?
- Date: Thu, 15 May 2008 16:12:10 -0400
- From: "Avery Pennarun" <apenwarr@xxxxxxxxx>
- Subject: Re: How can I tell if a SHA1 is a submodule reference?
On 5/15/08, Robin Luckey <robin@xxxxxxxxx> wrote:
> However, is there a simple and reliable way for me to know which SHA1
> hashes refer to such submodule objects? I'd like to simply ignore them.
I don't think there's a straightforward way to do this given *just*
the SHA1, in the same way that you can't know the path corresponding
to a blob given just its SHA1.
However, if you're looking at a tree that refers to a SHA1, the tree
will reference a submodule object as a "commit" instead of a "tree" or
"blob". git-ls-tree output looks something like this:
160000 commit ba75ff608fabafeaafeb48d55b125440b5a665bc my_subdir
I think it's reasonable to say that if it's type commit, then it's a
submodule. (Note that simply being a submodule doesn't *necessarily*
imply that it'll be unavailable; some people like to store all the
submodule objects in the local repository.)
Have fun,
Avery
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html