# [BUG] `git submodule update --init --recursive` stores gitdir in full path into `.git` of nested submodules

4 messages from 2016-03-30 to 2016-03-30. Participants: Norio Nomura, Stefan Beller, Junio C Hamano.
Thread: https://gitlist.dev/t/41874

## Norio Nomura, 2016-03-30 09:03

Subject: [BUG] `git submodule update --init --recursive` stores gitdir in full path into `.git` of nested submodules
Message-ID: <F89ED33B-E33D-4693-8559-4255727B78B8@gmail.com>
URL: https://gitlist.dev/e/F89ED33B-E33D-4693-8559-4255727B78B8%40gmail.com

```
Hi,

`git submodule update --init --recursive` stores `gitdir` in full path into `.git` of nested submodules.
So, working directory is not portable to another directory.

On following example, `Carthage/Checkouts/Quick/Externals/Nimble/` is nested submodule and `Carthage/Checkouts/Quick/Externals/Nimble/.git` contains full path.
https://gist.github.com/norio-nomura/17ce4bdf0151185e77d9b1fcfb5a469d

Thanks,
--
Norio Nomura @norio_nomura

```

## Stefan Beller, 2016-03-30 16:05

Subject: Re: [BUG] `git submodule update --init --recursive` stores gitdir in full path into `.git` of nested submodules
Message-ID: <CAGZ79kaa2uBmRZ_OPG9hVkrc29uj8Lx9b-6fgbcDNE0OGvJ+cg@mail.gmail.com>
URL: https://gitlist.dev/e/CAGZ79kaa2uBmRZ_OPG9hVkrc29uj8Lx9b-6fgbcDNE0OGvJ%2Bcg%40mail.gmail.com
In-Reply-To: <F89ED33B-E33D-4693-8559-4255727B78B8@gmail.com>

```
On Wed, Mar 30, 2016 at 2:03 AM, Norio Nomura <norio.nomura@gmail.com> wrote:
> Hi,
>
> `git submodule update --init --recursive` stores `gitdir` in full path into `.git` of nested submodules.
> So, working directory is not portable to another directory.

Are you reporting a regression bug? (Is that a new thing or has it
always been that way and you just discover that it is unfortunate?)
Which versions did you test with?

>
> On following example, `Carthage/Checkouts/Quick/Externals/Nimble/` is nested submodule and `Carthage/Checkouts/Quick/Externals/Nimble/.git` contains full path.
> https://gist.github.com/norio-nomura/17ce4bdf0151185e77d9b1fcfb5a469d
>
> Thanks,
> --
> Norio Nomura @norio_nomura
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

```

## Stefan Beller, 2016-03-30 17:24

Subject: Re: [BUG] `git submodule update --init --recursive` stores gitdir in full path into `.git` of nested submodules
Message-ID: <CAGZ79kZwSFjADYYC=FBFr8cWv08mv+H7E=Bx3N=J2Q_o8sK9qw@mail.gmail.com>
URL: https://gitlist.dev/e/CAGZ79kZwSFjADYYC%3DFBFr8cWv08mv%2BH7E%3DBx3N%3DJ2Q_o8sK9qw%40mail.gmail.com
In-Reply-To: <CAGZ79kaa2uBmRZ_OPG9hVkrc29uj8Lx9b-6fgbcDNE0OGvJ+cg@mail.gmail.com>

```
On Wed, Mar 30, 2016 at 9:05 AM, Stefan Beller <sbeller@google.com> wrote:
> On Wed, Mar 30, 2016 at 2:03 AM, Norio Nomura <norio.nomura@gmail.com> wrote:
>> Hi,
>>
>> `git submodule update --init --recursive` stores `gitdir` in full path into `.git` of nested submodules.
>> So, working directory is not portable to another directory.
>
> Are you reporting a regression bug? (Is that a new thing or has it
> always been that way and you just discover that it is unfortunate?)
> Which versions did you test with?

➜  15:34:32 git:(master) git --version
git version 2.8.0

at the end of your gist.
The same happens when using 2.7.4, it doesn't happen when using 2.6.6 though.

It turns out ee8838d (2015-09-08, submodule: rewrite `module_clone`
shell function in C)
broke it.

I'll look into fixing it.

Thanks,
Stefan


>
>>
>> On following example, `Carthage/Checkouts/Quick/Externals/Nimble/` is nested submodule and `Carthage/Checkouts/Quick/Externals/Nimble/.git` contains full path.
>> https://gist.github.com/norio-nomura/17ce4bdf0151185e77d9b1fcfb5a469d
>>
>> Thanks,
>> --
>> Norio Nomura @norio_nomura
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe git" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

```

## Junio C Hamano, 2016-03-30 20:54

Subject: Re: [BUG] `git submodule update --init --recursive` stores gitdir in full path into `.git` of nested submodules
Message-ID: <xmqqpoubsn3b.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqpoubsn3b.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <CAGZ79kZwSFjADYYC=FBFr8cWv08mv+H7E=Bx3N=J2Q_o8sK9qw@mail.gmail.com>

```
Stefan Beller <sbeller@google.com> writes:

> On Wed, Mar 30, 2016 at 9:05 AM, Stefan Beller <sbeller@google.com> wrote:
>> On Wed, Mar 30, 2016 at 2:03 AM, Norio Nomura <norio.nomura@gmail.com> wrote:
>>> Hi,
>>>
>>> `git submodule update --init --recursive` stores `gitdir` in full path into `.git` of nested submodules.
>>> So, working directory is not portable to another directory.
>>
>> Are you reporting a regression bug? (Is that a new thing or has it
>> always been that way and you just discover that it is unfortunate?)
>> Which versions did you test with?
>
> ➜  15:34:32 git:(master) git --version
> git version 2.8.0
>
> at the end of your gist.
> The same happens when using 2.7.4, it doesn't happen when using 2.6.6 though.
>
> It turns out ee8838d (2015-09-08, submodule: rewrite `module_clone`
> shell function in C)
> broke it.
>
> I'll look into fixing it.

Thanks.

This may be an unrelated tangent, but somewhere in "submodule init"
codepath seem to turn paths into absolute too aggressively.  Merging
your recent "path related fix" to 'pu' seems to break some test by
showing absolute paths when the test expects to see relative ones.

```
