# [RFC] Configurable name(s) for .gitmodules

5 messages from 2007-12-07 to 2007-12-10. Participants: Ping Yin, Sven Verdoolaege.
Thread: https://gitlist.dev/t/11178

## Ping Yin, 2007-12-07 16:00

Subject: [RFC] Configurable name(s) for .gitmodules
Message-ID: <46dff0320712070800j6dd83714j265b3f7b291b855c@mail.gmail.com>
URL: https://gitlist.dev/e/46dff0320712070800j6dd83714j265b3f7b291b855c%40mail.gmail.com

```
I have a super project with many submodules. Each kind of role may
check out different set of submodules. There are some common modules
which are almost checked out by every role.

Here comes my question: how to implement this elegantly? If all
submodules are put in the same .gitmodules, every role has to in the
command line manually designate all submodules to be checked out.
However, it's hard to remember which submodules is required by which
role, not to mention the so huge .gitmodules. Maybe a script for each
role can help, but it's a little ugly.

If the name for '.gitmodules' is configurable, we can check in
modules.roleA and modules.roleB, etc. Then role A can designate the
corresponding modules.roleA as .gitmodules. Furtherly, if mutiple
names are allowed,  for common modules, we can have modules.common and
then submodule.defaultnames="modules.common, modules.roleA"  to avoid
duplicated module name entires in both modules.roleA and
modules.roleB.

I have gone deeply into git-submodule.sh and see
"GIT_CONFIG=.gitmodules" is used. However, configuable multiple names
can't be implemented in this way.

Recap:
1. configurable name for '.gitmodules'
2. better to allow mutiple names
3. the implementation issue for mutiple names

-- 
Ping Yin

```

## Ping Yin, 2007-12-10 16:20

Subject: Re: [RFC] Configurable name(s) for .gitmodules
Message-ID: <46dff0320712100820yb41cbc6q5b36143bc6b6d47f@mail.gmail.com>
URL: https://gitlist.dev/e/46dff0320712100820yb41cbc6q5b36143bc6b6d47f%40mail.gmail.com
In-Reply-To: <46dff0320712070800j6dd83714j265b3f7b291b855c@mail.gmail.com>

```
On Dec 8, 2007 12:00 AM, Ping Yin <pkufranky@gmail.com> wrote:
> I have a super project with many submodules. Each kind of role may
> check out different set of submodules. There are some common modules
> which are almost checked out by every role.
>
> Here comes my question: how to implement this elegantly? If all
> submodules are put in the same .gitmodules, every role has to in the
> command line manually designate all submodules to be checked out.
> However, it's hard to remember which submodules is required by which
> role, not to mention the so huge .gitmodules. Maybe a script for each
> role can help, but it's a little ugly.
>
> If the name for '.gitmodules' is configurable, we can check in
> modules.roleA and modules.roleB, etc. Then role A can designate the
> corresponding modules.roleA as .gitmodules. Furtherly, if mutiple
> names are allowed,  for common modules, we can have modules.common and
> then submodule.defaultnames="modules.common, modules.roleA"  to avoid
> duplicated module name entires in both modules.roleA and
> modules.roleB.
>
> I have gone deeply into git-submodule.sh and see
> "GIT_CONFIG=.gitmodules" is used. However, configuable multiple names
> can't be implemented in this way.
>
> Recap:
> 1. configurable name for '.gitmodules'
> 2. better to allow mutiple names
> 3. the implementation issue for mutiple names
>

Can anyone give me some suggestion? Does it make sense to make
GIT_CONFIG record multiple config files, such as
"GIT_CONFIG=modules.roleA:modules.roleB"? Or any better way?

> --
> Ping Yin
>



-- 
Ping Yin

```

## Sven Verdoolaege, 2007-12-10 16:54

Subject: Re: [RFC] Configurable name(s) for .gitmodules
Message-ID: <20071210165436.GG3490MdfPADPa@greensroom.kotnet.org>
URL: https://gitlist.dev/e/20071210165436.GG3490MdfPADPa%40greensroom.kotnet.org
In-Reply-To: <46dff0320712070800j6dd83714j265b3f7b291b855c@mail.gmail.com>

```
On Sat, Dec 08, 2007 at 12:00:12AM +0800, Ping Yin wrote:
> I have a super project with many submodules. Each kind of role may
> check out different set of submodules. There are some common modules
> which are almost checked out by every role.
> 
> Here comes my question: how to implement this elegantly? If all
> submodules are put in the same .gitmodules, every role has to in the
> command line manually designate all submodules to be checked out.

You could have submodules (roles in your case) containing
other submodules, as proposed in the thread that ends in
http://thread.gmane.org/gmane.comp.version-control.git/48643/focus=48939

skimo

```

## Ping Yin, 2007-12-10 17:34

Subject: Re: [RFC] Configurable name(s) for .gitmodules
Message-ID: <46dff0320712100934o86af6femaaf563cf40295333@mail.gmail.com>
URL: https://gitlist.dev/e/46dff0320712100934o86af6femaaf563cf40295333%40mail.gmail.com
In-Reply-To: <20071210165200.GF3490MdfPADPa@greensroom.kotnet.org>

```
On Dec 11, 2007 12:52 AM, Sven Verdoolaege <skimo@kotnet.org> wrote:
> On Sat, Dec 08, 2007 at 12:00:12AM +0800, Ping Yin wrote:
> > I have a super project with many submodules. Each kind of role may
> > check out different set of submodules. There are some common modules
> > which are almost checked out by every role.
> >
> > Here comes my question: how to implement this elegantly? If all
> > submodules are put in the same .gitmodules, every role has to in the
> > command line manually designate all submodules to be checked out.
>
> You could have submodules (roles in your case) containing
> other submodules, as proposed in the thread that ends in
> http://thread.gmane.org/gmane.comp.version-control.git/48643/focus=48939
>
> skimo
>

Thanks for the suggestion. Linus's idea is what i want. As linus said,
one level of indirect will give much more flexibility. It's wonderful
to put something like following to .gitmodules.
	[module "infrastructure"]
		submodule = lib
		submodule = build

	[submodule "lib"]
		url = git://xyzzy/lib-1.2.3

	[submodule "build"]
		url = git://xyzzy/build-0.61

Also I  found Lars's following reply,  i still don't understand quite
well why this idea is not accepted.

> The reason I wanted to use
>
> [path "lib"]
>   submodule=xyzzylib
>   url=git://xyzzy/lib-1.2.3
>
> is that the git-submodule command always starts out with the submodule
> path, trying to map that to an url or a submodule name. My proposal
> allows
>
>   $ name=$(GIT_CONFIG=.gitmodules git-config path."$path".submodule)
>   $ url=$(GIT_CONFIG=.gitmodules git-config path."$path".url)
>


-- 
Ping Yin

```

## Ping Yin, 2007-12-10 17:35

Subject: Re: [RFC] Configurable name(s) for .gitmodules
Message-ID: <46dff0320712100935v2634fa7ajdc1af191debc9d59@mail.gmail.com>
URL: https://gitlist.dev/e/46dff0320712100935v2634fa7ajdc1af191debc9d59%40mail.gmail.com
In-Reply-To: <46dff0320712100934o86af6femaaf563cf40295333@mail.gmail.com>

```
On Dec 11, 2007 1:34 AM, Ping Yin <pkufranky@gmail.com> wrote:
>

> Also I  found Lars's following reply,  i still don't understand quite
> well why this idea is not accepted.

Sorry for the typo. It's 'Although', not 'Also'

>
>
> --
> Ping Yin
>



-- 
Ping Yin

```
