git-sh-setup.sh:cd_to_toplevel problematic with symlinks
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?
Another option is to have a new option to rev-parse which shows the absolute path to tho toplevel.
Your mail did not make it to the list, therefore I quote the full mail.
Quoted 27 lines · Uwe Kleine-König
Quoted 5 lines · Matthias Lederhofer
cd_to_topleveltakes 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:Quoted 8 lines
(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 deniedIs there any way to tell cd to ignore $PWD?
cd -P ... does the trick. IIRC it's in SUSv3, but once more, Solaris
/bin/shdoesn't know about that option:login@~ > uname -a
SunOS login 5.10 Generic_125100-10 sun4u sparclogin@~ >
/bin/sh$ mkdir
/tmp/foo; cd/tmp/foo$ git init
Initialized empty Git repository in .git/
Quoted 7 lines
$ 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.
Hello Matthias,
Quoted 2 lines · Matthias Lederhofer
Your mail did not make it to the list, therefore I quote the full mail.
Ops, thanks.
Quoted 5 lines
Quoted 4 lines · Uwe Kleine-König
Quoted 1 line
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/shdoesn't know about that option:
[...]
Quoted 4 lines
Do we care about that shell? There was another thread about shell script cleanup where the default sun
/bin/shdoesn't support some other features from the git shell scripts too.
Ah, I see, Makefile defines SHELL_PATH for SunOS to /bin/bash anyhow.
OK, then maybe just use it and if it breaks for someone we will notice it ...
Best regards
Uwe
Signature · 3 lines
Uwe Kleine-König http://www.google.com/search?q=12+mol+in+dozen