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

Submodule design

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Oct 2, 2012, 15:23 UTC
Message-ID
<CALkWK0kYh3tKXRqRO9SFMHkrytmhXFkR3yHwmiTpw6KocuLzZw@mail.gmail.com>
Hi,

Today I learnt that a gitlink is a commit object embedded in a tree. However, I can't seem to be able to cat it.

    $ git ls-tree HEAD
    100644 blob 5a91f388f3648b98ae34a19ec42ba9acc7852ef4    .gitmodules
    160000 commit 8daa12004db8862b22f6c7dd244a88ac6108b194  dotfiles
    $ git cat-file 8daa12004db8862b22f6c7dd244a88ac6108b194
    fatal: git cat-file 8daa12004db8862b22f6c7dd244a88ac6108b194: bad file

Why is this? Does the object not exist in the object store at all? Then how was it embedded in the toplevel tree object in the first place? Also, why (how) does 'git diff' give me the impression that it's a blob?

    $ git diff
    diff --git a/dotfiles b/dotfiles
    index 8daa120..ff61f40 160000
    --- a/dotfiles
    +++ b/dotfiles
    @@ -1 +1 @@
    -Subproject commit 8daa12004db8862b22f6c7dd244a88ac6108b194
    +Subproject commit ff61f40e0938024aa3b748eb733a974b17082ec2

If it is really a blob, I should be able to stage and unstage it normally, but the following command is a no-op:

    $ git checkout -- dotfiles
What is going on?  Shouldn't we get rid of these ugly inconsistencies?
Ram
Next: Sascha Cunz
Message 1 of 3 in “Submodule design”
  1. Ramkumar RamachandraOct 2, 2012
  2. Sascha CunzOct 2, 2012
  3. Junio C HamanoOct 2, 2012

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.