git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Avery Pennarun" <apenwarr@gmail.com>
To: "skillzero@gmail.com" <skillzero@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Why do git submodules require manual checkouts and commits?
Date: Fri, 16 May 2008 09:43:33 -0400	[thread overview]
Message-ID: <32541b130805160643y3bfe609et22b2d00627f98c04@mail.gmail.com> (raw)
In-Reply-To: <2729632a0805152116o3c998324xb401674207dd2e1e@mail.gmail.com>

On 5/16/08, skillzero@gmail.com <skillzero@gmail.com> wrote:
> Why do git submodules require manually committing the submodule itself
>  to each super repository after something in the submodule repository
>  changes? Is there some reason the super repository can't just "link"
>  to the submodules by branch name? It seems that if the .gitsubmodules
>  also specified the branch to use:

This is difficult but (contrary to what others might say :)) in my
opinion it's worth fixing.  Exactly how to fix it is an open question
though.

The main reason the simple approach you suggested (just link to a
branch instead of a particular commit) isn't good is that it doesn't
guarantee you always get the same version every time.  If the
supermodule links to submodule branch "foo" and makes supermodule
commit 23abc918c, and someone later pushes to submodule branch "foo",
then checking out commit 23abc918c in the supermodule would get the
very latest submodule "foo", not the one you had when 23abc918c was
created.  Thus all sorts of bad things could happen.

So I think it would be very bad if the supermodule automatically
updated to the latest version of the submodule whenever you commit in
the submodule.  *However*, the other way around might be fine: if you
commit in the supermodule, maybe it should commit in the submodule at
the same time and link to that specific commit.  I'm pretty sure that
idea doesn't have any *fundamental* flaws, it's just got a lot of
really tricky details that need to be worked out.  I've seen some
"recursive commit" and "recursive push" patches floating around, so
people are actively working on this.  One of the hardest things to
deal with is where to auto-push submodules to (which remote? which
branch?) when you push the supermodule.

Have fun,

Avery

  parent reply	other threads:[~2008-05-16 13:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-16  4:16 Why do git submodules require manual checkouts and commits? skillzero
2008-05-16 10:17 ` Johannes Schindelin
2008-05-16 13:43 ` Avery Pennarun [this message]
2008-05-16 13:58   ` Johannes Schindelin
2008-05-16 14:12     ` Avery Pennarun
2008-05-16 14:24       ` Johannes Schindelin
2008-05-16 14:44         ` Avery Pennarun
2008-05-16 14:58         ` Lars Hjemli
2008-05-19  4:38   ` skillzero

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=32541b130805160643y3bfe609et22b2d00627f98c04@mail.gmail.com \
    --to=apenwarr@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=skillzero@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).