threads / discuss / 30590

Question about submodules and absolute paths

Subject: Question about submodules and absolute paths

## tl;dr

14 messages between May 22, 2012 and May 24, 2012.

replies: 13people: 5as markdown or json

Alexey Pelykh· May 22, 2012, 11:36 UTC · lore
Hello,

Is it possible to avoid usage of absolute paths in information about submodule? I'm working with same local repository from both Windows and Linux. But unfortunately absolute paths in modules break all the sweetness, since these paths differ from OS to OS and thus I have to keep two clones of each repository. Regarding absolute paths I refer to are:

In ${REPO}/.git/modules/${MODULE_RELATIVE_PATH}/config file:
[core]
   worktree =  ${FULL_REPO_PATH}/${MODULE_RELATIVE_PATH}

In ${REPO}/${MODULE_RELATIVE_PATH}/.git file: gitdir: ${FULL_REPO_PATH}/.git/modules/${MODULE_RELATIVE_PATH}

Thanks, Alexey

Junio C Hamano· May 22, 2012, 18:27 UTC · re: Alexey Pelykh · lore

Re: Question about submodules and absolute paths

Alexey Pelykh <alexey.pelykh@gmail.com> writes:
> since these paths differ from OS to OS and thus I have to keep two clones of
> each repository.

I am not sure what "absolute path" has with this. If you are working on two machines, don't you need two clones, one for each, anyway?

Alexey Pelykh· May 22, 2012, 19:18 UTC · re: Junio C Hamano · lore

Re: Question about submodules and absolute paths

Not on two machines, on single machine but with two OSes Windows + Linux + shared 'work' partition :) So both Windows and Linux use same repo clone that is stored on a 'work' partition. But due to those absolute paths, it gives '/cygdrive/d/work' on windows and '/media/work' on linux. Thus I have to keep 2 copies of each repository that uses submodules (and that is very inconvenient :( )

On Tue, May 22, 2012 at 9:27 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 7 quoted lines
> Alexey Pelykh <alexey.pelykh@gmail.com> writes:
>
>> since these paths differ from OS to OS and thus I have to keep two clones of
>> each repository.
>
> I am not sure what "absolute path" has with this.  If you are working on
> two machines, don't you need two clones, one for each, anyway?
Matt Seitz (matseitz)· May 22, 2012, 19:25 UTC · re: Alexey Pelykh · lore

RE: Question about submodules and absolute paths

> From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On
> Behalf Of Alexey Pelykh
> 
> Not on two machines, on single machine but with two OSes Windows +
Linux +
> shared 'work' partition :) So both Windows and Linux use same repo
clone
> that is stored on a 'work' partition. But due to those absolute paths,
it
> gives '/cygdrive/d/work' on windows and '/media/work' on linux. Thus I
> have to keep 2 copies of each repository that uses submodules (and
that is
> very inconvenient :( )

As a workaround, how about using Cygwin's mount table to mount "/media" to "d:/", or "/media/work" to "d:/work"?

See: http://cygwin.com/cygwin-ug-net/using.html#mount-table

Alexey Pelykh· May 22, 2012, 19:29 UTC · re: Matt Seitz (matseitz) · lore

Re: Question about submodules and absolute paths

Thanks, Matt.

Indeed this is a workaround, what I was thinking about to use. The thing I wanted actually to discuss whether it worth to research possibility of replacing these absolute paths with relative ones. At least afaik, git repo clone is fully portable (movable) except for submodules. So I wanted to ask community if this is an intended behavior, or it may (and should?) be refined.

Best regards, Alexey

On Tue, May 22, 2012 at 10:25 PM, Matt Seitz (matseitz) <matseitz@cisco.com> wrote:

Show 20 quoted lines
>> From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On
>> Behalf Of Alexey Pelykh
>>
>> Not on two machines, on single machine but with two OSes Windows +
> Linux +
>> shared 'work' partition :) So both Windows and Linux use same repo
> clone
>> that is stored on a 'work' partition. But due to those absolute paths,
> it
>> gives '/cygdrive/d/work' on windows and '/media/work' on linux. Thus I
>> have to keep 2 copies of each repository that uses submodules (and
> that is
>> very inconvenient :( )
>
> As a workaround, how about using Cygwin's mount table to mount "/media"
> to "d:/", or "/media/work" to "d:/work"?
>
> See:
> http://cygwin.com/cygwin-ug-net/using.html#mount-table
>
Matt Seitz (matseitz)· May 22, 2012, 19:36 UTC · re: Alexey Pelykh · lore

RE: Question about submodules and absolute paths

> From: Alexey Pelykh [mailto:alexey.pelykh@gmail.com]
> 
> Indeed this is a workaround, what I was thinking about to use. The
thing I
> wanted actually to discuss whether it worth to research possibility of
> replacing these absolute paths with relative ones. 

Sure. I just wanted to offer an immediate, interim solution until there is a decision on the permanent solution.

Alexey Pelykh· May 22, 2012, 20:25 UTC · re: Matt Seitz (matseitz) · lore

Re: Question about submodules and absolute paths

Getting back to the topic, who has what opinions on it?

On Tue, May 22, 2012 at 10:36 PM, Matt Seitz (matseitz) <matseitz@cisco.com> wrote:

Show 10 quoted lines
>> From: Alexey Pelykh [mailto:alexey.pelykh@gmail.com]
>>
>> Indeed this is a workaround, what I was thinking about to use. The
> thing I
>> wanted actually to discuss whether it worth to research possibility of
>> replacing these absolute paths with relative ones.
>
> Sure.  I just wanted to offer an immediate, interim solution until there
> is a decision on the permanent solution.
>
Junio C Hamano· May 22, 2012, 21:06 UTC · re: Alexey Pelykh · lore

Re: Question about submodules and absolute paths

Alexey Pelykh <alexey.pelykh@gmail.com> writes:
> Getting back to the topic, who has what opinions on it?

You wait ;-) I do not think our friends in certain timezones had chance to see your message and think about it yet.

Didn't the submodule folks worked on the related area recently, and doesn't the result of their work already in v1.7.10?

I am thinking specifically about the series around d75219b (submodules: always use a relative path from gitdir to work tree, 2012-03-04). Jens?

Jens Lehmann· May 23, 2012, 07:24 UTC · re: Junio C Hamano · lore

Re: Question about submodules and absolute paths

Am 22.05.2012 23:06, schrieb Junio C Hamano:
Show 5 quoted lines
> Didn't the submodule folks worked on the related area recently, and
> doesn't the result of their work already in v1.7.10?
> 
> I am thinking specifically about the series around d75219b (submodules:
> always use a relative path from gitdir to work tree, 2012-03-04).  Jens?
Yes, these changes should fix the problem described by Alexey.
Alexey Pelykh· May 23, 2012, 07:32 UTC · re: Jens Lehmann · lore

Re: Question about submodules and absolute paths

Great! I'll try git from sources then
On Wed, May 23, 2012 at 10:24 AM, Jens Lehmann <Jens.Lehmann@web.de> wrote:
Show 9 quoted lines
>
> Am 22.05.2012 23:06, schrieb Junio C Hamano:
> > Didn't the submodule folks worked on the related area recently, and
> > doesn't the result of their work already in v1.7.10?
> >
> > I am thinking specifically about the series around d75219b (submodules:
> > always use a relative path from gitdir to work tree, 2012-03-04).  Jens?
>
> Yes, these changes should fix the problem described by Alexey.
Jens Lehmann· May 23, 2012, 20:42 UTC · re: Alexey Pelykh · lore

Re: Question about submodules and absolute paths

[please do not top-post]
Am 23.05.2012 09:32, schrieb Alexey Pelykh:
Show 12 quoted lines
> On Wed, May 23, 2012 at 10:24 AM, Jens Lehmann <Jens.Lehmann@web.de> wrote:
>>
>> Am 22.05.2012 23:06, schrieb Junio C Hamano:
>>> Didn't the submodule folks worked on the related area recently, and
>>> doesn't the result of their work already in v1.7.10?
>>>
>>> I am thinking specifically about the series around d75219b (submodules:
>>> always use a relative path from gitdir to work tree, 2012-03-04).  Jens?
>>
>> Yes, these changes should fix the problem described by Alexey.
>
> Great! I'll try git from sources then

But don't forget to re-clone the submodules, the paths won't be updated for existing submodules.

Alexey Pelykh· May 24, 2012, 05:08 UTC · re: Jens Lehmann · lore

Re: Question about submodules and absolute paths

Thanks for pointing that out
On Wed, May 23, 2012 at 11:42 PM, Jens Lehmann <Jens.Lehmann@web.de> wrote:
Show 20 quoted lines
> [please do not top-post]
>
> Am 23.05.2012 09:32, schrieb Alexey Pelykh:
>> On Wed, May 23, 2012 at 10:24 AM, Jens Lehmann <Jens.Lehmann@web.de>
>> wrote:
>>>
>>> Am 22.05.2012 23:06, schrieb Junio C Hamano:
>>>> Didn't the submodule folks worked on the related area recently, and
>>>> doesn't the result of their work already in v1.7.10?
>>>>
>>>> I am thinking specifically about the series around d75219b (submodules:
>>>> always use a relative path from gitdir to work tree, 2012-03-04).
>>>>  Jens?
>>>
>>> Yes, these changes should fix the problem described by Alexey.
>>
>> Great! I'll try git from sources then
>
> But don't forget to re-clone the submodules, the paths won't be updated
> for existing submodules.
Johannes Sixt· May 23, 2012, 05:36 UTC · re: Alexey Pelykh · lore

Re: Question about submodules and absolute paths

Am 5/22/2012 21:18, schrieb Alexey Pelykh:
Show 6 quoted lines
> Not on two machines, on single machine but with two OSes
> Windows + Linux + shared 'work' partition :) So both Windows and Linux
> use same repo clone that is stored on a 'work' partition. But due to
> those absolute paths, it gives '/cygdrive/d/work' on windows and
> '/media/work' on linux. Thus I have to keep 2 copies of each
> repository that uses submodules (and that is very inconvenient :( )

I think you cannot share the index file between OSes. Even though its file format should be portable, the contents (stat information) is not portable. After you boot into a different OS, you need at least a 'git status' call to populate the index with the stat data from the new OS.

-- Hannes
Alexey Pelykh· May 23, 2012, 05:39 UTC · re: Johannes Sixt · lore

Re: Question about submodules and absolute paths

Thanks for pointing this I haven't experienced issue with this. Maybe due to my git on Windows is actually part of cygwin? Or maybe git status is 99% is what I do before any operation with git :)

On Wed, May 23, 2012 at 8:36 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:
Show 15 quoted lines
>
> Am 5/22/2012 21:18, schrieb Alexey Pelykh:
> > Not on two machines, on single machine but with two OSes
> > Windows + Linux + shared 'work' partition :) So both Windows and Linux
> > use same repo clone that is stored on a 'work' partition. But due to
> > those absolute paths, it gives '/cygdrive/d/work' on windows and
> > '/media/work' on linux. Thus I have to keep 2 copies of each
> > repository that uses submodules (and that is very inconvenient :( )
>
> I think you cannot share the index file between OSes. Even though its file
> format should be portable, the contents (stat information) is not
> portable. After you boot into a different OS, you need at least a 'git
> status' call to populate the index with the stat data from the new OS.
>
> -- Hannes

← back to recent threads