Subject: Re: ''git submodule sync'' should not add uninitialized submodules to .git/config

From: Andreas Köhler <[email-masked]>
Date: Fri, 24 Jun 2011 01:10:29 +0200

Am 24.06.2011 00:28, schrieb Junio C Hamano:
---8<---
> Subject: submodule sync: do not auto-vivify uninteresting submodule
> 
> Earlier 33f072f (submodule sync: Update "submodule.<name>.url" for empty
> directories, 2010-10-08) attempted to fix a bug where "git submodule sync"
> command does not update the URL if the current superproject does not have
> a checkout of the submodule.
> 
> However, it did so by unconditionally registering submodule.$name.url to
> every submodule in the project, even the ones that the user has never
> showed interest in at all by running 'git submodule init' command. This
> caused subsequent 'git submodule update' to start cloning/updating submodules
> that are not interesting to the user at all.
> 
> Update the code so that the URL is updated from the .gitmodules file only
> for submodules that already have submodule.$name.url entries, i.e. the
> ones the user has showed interested in having a checkout.
---8<---

I think that describes the situation pretty well and the patch looks
good. I will not be able to test it before next week though, do not wait
for me.

There are two minor issues for me left.
(1) The man page of submodule sync talks about "all submodules" and not
"registered submodules". I treated it as "subsequent init" and
personally do not restrict the list of submodules, simply because my
build would not work without them.

(2) It is confusing to have registered submodules in .git/config without
a matching gitlink. Say, you switch between branch a1 with a submodule s
with url u1, to a branch without s, you git clean -xdff (url u1 is still
in .git/config, right?), and then to a branch a2 with s pointing to url
u2. This bugged me.

Ciao,
-- andi5