Subject: Re: [PATCH 0/2] submodules: Use relative paths to gitdir and work tree

From: Johannes Sixt <[email-masked]>
Date: Mon, 27 Feb 2012 22:19:19 +0100

Am 26.02.2012 20:58, schrieb Jens Lehmann:
> Am 26.02.2012 18:38, schrieb Johannes Sixt:
>> -	a=$(cd "$gitdir" && pwd)
>> -	b=$(cd "$path" && pwd)
>> +	a=$(cd "$gitdir" && pwd -W)
>> +	b=$(cd "$path" && pwd -W)
>>  	while [ "$b" ] && [ "${a%%/*}" = "${b%%/*}" ]
>>  	do
>>  		a=${a#*/} b=${b#*/};
> 
> I don't understand why you need this. Does "pwd" sometimes return a
> path starting with "c:/" and sometimes "/c/" depending on what form
> you use when you cd into that directory?

It looks like this is the case. I was surprised as well. I hoped that
pwd -P would fix it, but it makes no difference. I should have tested
pwd -L as well, but I forgot.

> -       gitdir=$(git rev-parse --git-dir)
> +       gitdir=$(git rev-parse --git-dir | sed -e 's,^\([a-z]\):/,/\1/,')

I don't like pipelines of this kind because they fork yet another
process. But it looks like there are not that many alternatives...

-- Hannes