Re: How can I tell if a SHA1 is a submodule reference?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for the replies -- checking the mode bits was the ticket.

Robin

On May 15, 2008, at 1:21 PM, Junio C Hamano wrote:

Robin Luckey <robin@xxxxxxxxx> writes:

I am parsing the output of git-diff-tree to create some code analysis
reports.

When a user adds a submodule to a repository, git-diff-tree reports
the SHA1 of the commit from the submodule.

However, if I subsequently try to pass this SHA1 to git-cat-file, or
indeed any other git command I have tried, I receive an error:

error: unable to find b0f8c354b142e27333abd0f175544b71a0cc444e
fatal: Not a valid object name b0f8c354b142e27333abd0f175544b71a0cc444e

This makes sense to me, since these objects are not stored locally;
they are stored in the submodule repository.

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 presume you are reading "diff-tree --raw" format output. The mode bits for submodules (aka gitlinks) are 160000, as opposed to either 100644 or
100755 for regular files and 120000 for symbolic links.



--
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux