Re: [PATCH 0/2] submodules: Use relative paths to gitdir and work tree
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Feb 27, 2012, 21:19 UTC
- Message-ID
- <4F4BF357.8020407@kdbg.org>
- In-Reply-To
- <4F4A8EF2.3020901@web.de>
Am 26.02.2012 20:58, schrieb Jens Lehmann:
Show 12 quoted lines
> 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