git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Jens LehmannNext: Johannes Schindelin
Message 16 of 21 in “submodules: Use relative paths to gitdir and work tree”
  1. 0/2 submodules: Use relative paths to gitdir and work treeJens Lehmann, Feb 8, 2012
  2. 1/2 submodules: always use a relative path to gitdirJens Lehmann, Feb 8, 2012
  3. 1/2 submodules: always use a relative path to gitdirJens Lehmann, Feb 9, 2012
  4. Junio C HamanoFeb 9, 2012
  5. Junio C HamanoFeb 9, 2012
  6. Jens LehmannFeb 9, 2012
  7. 2/2 submodules: always use a relative path from gitdir to work treeJens Lehmann, Feb 8, 2012
  8. 2/2 submodules: always use a relative path from gitdir to work treeJens Lehmann, Feb 9, 2012
  9. Junio C HamanoFeb 13, 2012
  10. Jens LehmannFeb 14, 2012
  11. Junio C HamanoFeb 14, 2012
  12. Junio C HamanoFeb 14, 2012
  13. Jens LehmannFeb 15, 2012
  14. Johannes SixtFeb 26, 2012
  15. Jens LehmannFeb 26, 2012
  16. Johannes SixtFeb 27, 2012
  17. Johannes SchindelinFeb 27, 2012
  18. Johannes SixtFeb 28, 2012
  19. Junio C HamanoFeb 28, 2012
  20. Jens LehmannFeb 28, 2012
  21. Jens LehmannFeb 28, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.