From: Sam Vilain <sam@vilain.net>
To: Avery Pennarun <apenwarr@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
Eyvind Bernhardsen <eyvind-git@orakel.ntnu.no>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: git-submodule getting submodules from the parent repository
Date: Thu, 03 Apr 2008 09:06:36 +1300 [thread overview]
Message-ID: <47F3E74C.5010804@vilain.net> (raw)
In-Reply-To: <32541b130804011903u3b5d0794w984e26c4570c4688@mail.gmail.com>
Avery Pennarun wrote:
>> > Instead of storing only the commitid of each submodule in the parent
>> > tree, store the current branch name as well.
>> That goes quite against the fundamental design of git submodules in that
>> the submodules are by themselves independent entities.
>>
> Not sure what you mean here; the supermodule already stores the
> commitid of the submodule. All I'm proposing is that it also store
> the default branchname (ie. the branchname that the submodule was
> using when its gitlink was checked into the supermodule) along with
> that commitid. The submodule never knows anything about the
> supermodule.
>
How about this.
This could be an optional disambiguator in .gitmodules in the
superproject, to allow you to "store the branch it was made from". Glue
to make this automatic/easy optional.
When updating a submodule, with an option set (or configured; which
might even later become a default if people like it enough), it will try
to figure out a reasonable branch for that commit, using git-name-rev,
and check out the branch with that name. It first uses the hint above
as an argument to git-name-rev --refs=XX, and if that doesn't provide a
reasonable answer then look for any branch.
I think this approach would not get in the way of people who don't want
to use it, and provide for making things automatic for those who want that.
> I agree that the submodule should have its HEAD pointing at exactly
> the superproject-specified commit. However, I believe this commit
> should have a local branch name (in the subproject) attached to it, or
> else (as I and my co-workers have frequently experienced) people will
> accidentally check in to a nameless branch, causing 'git push' to
> silently not upload anything, and thus lose track of their commits. I
> have lost work this way.
>
I think this is a separate argument against git-push, the default
behaviour of which also causes me to tell people not to use the
argument-less form of git-push until they understand how to use the
two-argument form.
In the context of git-submodule, adding features to it to avoid this if
that is the way that the user wants to work would be good IMHO.
> The idea of naming the local-subproject-branch with the same name as
> it had on checking is that then "git pull" in the subproject will work
> exactly as expected:
It's not really the local branch name anyway, it's how the default push
gets configured; perhaps it's worth distinguishing which part you are
interested in.
> The super-summary of all that is I think I'd like to make three git
> changes here:
>
> 1) When checking out a submodule from scratch, use the local
> supermodule as a --alternate. That way if both super and submodule
> are hosted in the same remote repo, I don't have to clone them twice.
> (And cloning my local repo to another copy doesn't stop git-submodule
> from working.)
>
Yes - you've already seen the SoC plan for that, although I believe no
students applied for that one, and if you think it's minor enough to do,
great.
> 2) When checking out a submodule, give the submodule's current commit
> a useful branch name (ideally, the name it had when the gitlink was
> checked into the supermodule). When updating a submodule with
> git-submodule-update, quietly fixup the submodule's local branch ref
> if it hasn't been changed; else produce a conflict of some sort.
>
See above for how I think that should work.
> 3) Bonus: make "git push" operate recursively on submodules, and "git
> pull" automatically run git-submodule-update.
>
I'd appreciate that feature - though I'm more interested in making sure
that I don't push anything where the submodule commit is not available
via the URL listed in .gitmodules.
Presuming such a check, would that check happen at push time, or do you
check at a different time, such as when committing, or when adding the
submodule to the index?
I think checking that referential integrity is something perhaps easier
to bite off and get people to agree on. I think it would solve the
overall process problem, by forcing people to push the submodule before
the commit of the superproject can succeed without forcing.
Thoughts/comments?
Sam
next prev parent reply other threads:[~2008-04-02 20:07 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-29 22:35 git-submodule getting submodules from the parent repository Avery Pennarun
2008-03-29 23:22 ` Sam Vilain
2008-03-30 13:32 ` Eyvind Bernhardsen
2008-03-30 17:48 ` Sam Vilain
2008-03-30 19:50 ` Eyvind Bernhardsen
2008-03-30 20:19 ` Sam Vilain
2008-03-31 10:05 ` Eyvind Bernhardsen
2008-03-30 23:03 ` Avery Pennarun
2008-03-31 9:29 ` Eyvind Bernhardsen
2008-03-31 21:36 ` Avery Pennarun
2008-04-01 23:05 ` Sam Vilain
2008-04-01 23:56 ` Avery Pennarun
2008-04-02 0:35 ` Junio C Hamano
2008-04-02 2:03 ` Avery Pennarun
2008-04-02 20:06 ` Sam Vilain [this message]
2008-04-02 21:32 ` Junio C Hamano
2008-03-30 23:00 ` Avery Pennarun
2008-04-01 23:10 ` Sam Vilain
2008-03-31 6:22 ` Johannes Sixt
2008-03-31 21:24 ` Avery Pennarun
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=47F3E74C.5010804@vilain.net \
--to=sam@vilain.net \
--cc=apenwarr@gmail.com \
--cc=eyvind-git@orakel.ntnu.no \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).