git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: Submodule design
Date: Tue, 02 Oct 2012 10:49:36 -0700	[thread overview]
Message-ID: <7vr4pg932n.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <CALkWK0kYh3tKXRqRO9SFMHkrytmhXFkR3yHwmiTpw6KocuLzZw@mail.gmail.com> (Ramkumar Ramachandra's message of "Tue, 2 Oct 2012 20:53:28 +0530")

Ramkumar Ramachandra <artagnon@gmail.com> writes:

> 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

Is this handcrafted typescript?  You do not have "-t" nor "commit"
after cat-file, so you should have got the usage message.

In any case, not having the commit object available in the
superproject is essential and fundamental.

Binding a separate project as a submodule at a specific path in the
superproject, instead of adding the tree structure as a subdirectory
as part of the superproject, is what allows you (note this is not
"requires") to work with the superproject _without_ having to
populate the submodule.  Imagine a submodule for the source of a
library the superproject uses and the superproject is arranged in
such a way that you can build the whole thing from the source, or
you can use the installed library and link to it.  When doing the
latter, you do not have to "submodule init" that part.

The only thing the superproject needs to record is what specific
state of the submodule is meant to appear, if it is instantiated, in
the path.  We (primarily Linus, actually) chose to do so by
recording the name of the commit object from the submodule after
considering other possibilities (check the list archive).

And having to include that commit object in the superproject defeats
the whole point of binding a _separate_ and _independent_ project as
a submodule.  You could deliberately arrange the submodule so that
it shares the object store with the superproject, but that is not
the common or default mode of operation.  Not finding an object from
the submodule's history in the superproject is perfectly normal.

> What is going on?  Shouldn't we get rid of these ugly inconsistencies?

I do not see anything ugly or inconsistent, except that the way you
phrased your message may be unnecessarily an ugly way to show
frustration coming either from a lack of understanding or from a
simple misunderstanding.

      parent reply	other threads:[~2012-10-02 17:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-02 15:23 Submodule design Ramkumar Ramachandra
2012-10-02 15:38 ` Sascha Cunz
2012-10-02 17:49 ` Junio C Hamano [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=7vr4pg932n.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).