git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git cat-file on a submodule

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 11, 2017, 18:56 UTC
Message-ID
<xmqqshopo26j.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170111125330.3skwxdleoooacts6@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 8 quoted lines
> On Tue, Jan 10, 2017 at 07:11:40PM -0500, David Turner wrote:
>
>> Why does git cat-file -t $sha:foo, where foo is a submodule, not work?
> ...
> I'm not sure if I'm complaining or not. I can't immediately think of
> something that would be horribly broken. But it really feels like you
> are using the wrong tool, and patching the tool to handle this case will
> probably lead to weird cognitive dissonance down the road.

"git cat-file [any option] $sha" should fail and complain for any $sha that does not name an object that exists in the object database of the repository it is working on.

So I'd complain if the first example command quoted above from David's mail stopped failing when the commit bound at 'foo' in the top-level treeish $sha (i.e. a commit in the submodule) does not exist in the top-level repository's object database.

Show 7 quoted lines
> Maybe it would help to describe your use case more fully. If what you
> care about is the presumed type based on the surrounding tree, then
> maybe:
>
>   git --literal-pathspecs ls-tree $sha -- foo
>
> would be a better match.
Yup.
Previous: David Turner
Message 5 of 5 in “git cat-file on a submodule”
  1. David TurnerJan 11, 2017
  2. Stefan BellerJan 11, 2017
  3. Jeff KingJan 11, 2017
  4. David TurnerJan 11, 2017
  5. Junio C HamanoJan 11, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.