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

Re: git-sh-setup.sh:cd_to_toplevel problematic with symlinks

From
MLMatthias Lederhofer <matled@gmx.net>
Date
Aug 7, 2007, 10:11 UTC
Message-ID
<20070807101155.GA19233@moooo.ath.cx>
In-Reply-To
<20070806211238.GA27363@informatik.uni-freiburg.de>

Your mail did not make it to the list, therefore I quote the full mail.

Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> wrote:
Show 34 quoted lines
> Matthias Lederhofer wrote:
> > cd_to_toplevel takes the output of git rev-parse --show-cdup and feeds
> > it to cd.  The problem is that cd uses PWD to do what the user means
> > when saying cd .., i.e. it goes to /foo when in /foo/bar even though
> > /foo/bar might be a symlink.  Example:
> > 
> >     (in an existing git repository)
> >     /tmp/foo$ mkdir -p a/b
> >     /tmp/foo$ ln -s a/b c
> >     /tmp/foo$ cd c
> >     /tmp/foo/c$ git fetch . master:master
> >     git-fetch: line 108: /FETCH_HEAD: Permission denied
> > 
> > Is there any way to tell cd to ignore $PWD?
> cd -P ... does the trick.  IIRC it's in SUSv3, but once more, Solaris
> /bin/sh doesn't know about that option:
> 
> 	login@~ > uname -a
> 	SunOS login 5.10 Generic_125100-10 sun4u sparc
> 
> 	login@~ > /bin/sh
> 
> 	$ mkdir /tmp/foo; cd /tmp/foo
> 
> 	$ git init
> 	Initialized empty Git repository in .git/
> 
> 	$ mkdir -p a/b; ln -s a/b c; cd c
> 
> 	$ git rev-parse --show-cdup
> 	../../
> 
> 	$ cd -P ../../
> 	-P: does not exist

Do we care about that shell? There was another thread about shell script cleanup where the default sun /bin/sh doesn't support some other features from the git shell scripts too.

Previous: Matthias LederhoferNext: Uwe Kleine-König
Message 2 of 3 in “git-sh-setup.sh:cd_to_toplevel problematic with symlinks”
  1. Matthias LederhoferAug 6, 2007
  2. Matthias LederhoferAug 7, 2007
  3. Uwe Kleine-KönigAug 7, 2007

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.