Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Robin Luckey <robin@ohloh.net>
Cc: git@vger.kernel.org
Subject: Re: How can I tell if a SHA1 is a submodule reference?
Date: Thu, 15 May 2008 13:21:11 -0700	[thread overview]
Message-ID: <7vabirgvyg.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <7F242E8F-13CF-4BE5-B3E6-85F285391658@ohloh.net> (Robin Luckey's message of "Thu, 15 May 2008 12:39:03 -0700")

Robin Luckey <robin@ohloh.net> 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.

  parent reply	other threads:[~2008-05-15 20:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-15 19:39 How can I tell if a SHA1 is a submodule reference? Robin Luckey
2008-05-15 20:12 ` Avery Pennarun
2008-05-15 20:13 ` Linus Torvalds
2008-05-15 20:21 ` Junio C Hamano [this message]
2008-05-15 20:56   ` Robin Luckey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vabirgvyg.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=robin@ohloh.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox