{"thread":{"id":"9411","subject":"git-sh-setup.sh:cd_to_toplevel problematic with symlinks","startedAt":"2007-08-06T16:10:45Z","lastAt":"2007-08-07T12:45:26Z","messageCount":3,"participants":["Matthias Lederhofer","Uwe Kleine-König"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"50029","messageId":"20070806161045.GA21815@moooo.ath.cx","threadId":"9411","inReplyTo":null,"subject":"git-sh-setup.sh:cd_to_toplevel problematic with symlinks","fromName":"Matthias Lederhofer","fromEmail":"matled@gmx.net","sentAt":"2007-08-06T16:10:45Z","receivedAt":"2007-08-06T16:10:45Z","isPatch":false,"sender":{"key":"matled@gmx.net","avatar":null},"body":"cd_to_toplevel takes the output of git rev-parse --show-cdup and feeds\nit to cd.  The problem is that cd uses PWD to do what the user means\nwhen saying cd .., i.e. it goes to /foo when in /foo/bar even though\n/foo/bar might be a symlink.  Example:\n\n    (in an existing git repository)\n    /tmp/foo$ mkdir -p a/b\n    /tmp/foo$ ln -s a/b c\n    /tmp/foo$ cd c\n    /tmp/foo/c$ git fetch . master:master\n    git-fetch: line 108: /FETCH_HEAD: Permission denied\n\nIs there any way to tell cd to ignore $PWD?\n\nAnother option is to have a new option to rev-parse which shows the\nabsolute path to tho toplevel.\n"},{"id":"50110","messageId":"20070807101155.GA19233@moooo.ath.cx","threadId":"9411","inReplyTo":"20070806211238.GA27363@informatik.uni-freiburg.de","subject":"Re: git-sh-setup.sh:cd_to_toplevel problematic with symlinks","fromName":"Matthias Lederhofer","fromEmail":"matled@gmx.net","sentAt":"2007-08-07T10:11:56Z","receivedAt":"2007-08-07T10:11:56Z","isPatch":false,"sender":{"key":"matled@gmx.net","avatar":null},"body":"Your mail did not make it to the list, therefore I quote the full\nmail.\n\nUwe Kleine-König <ukleinek@informatik.uni-freiburg.de> wrote:\n> Matthias Lederhofer wrote:\n> > cd_to_toplevel takes the output of git rev-parse --show-cdup and feeds\n> > it to cd.  The problem is that cd uses PWD to do what the user means\n> > when saying cd .., i.e. it goes to /foo when in /foo/bar even though\n> > /foo/bar might be a symlink.  Example:\n> > \n> >     (in an existing git repository)\n> >     /tmp/foo$ mkdir -p a/b\n> >     /tmp/foo$ ln -s a/b c\n> >     /tmp/foo$ cd c\n> >     /tmp/foo/c$ git fetch . master:master\n> >     git-fetch: line 108: /FETCH_HEAD: Permission denied\n> > \n> > Is there any way to tell cd to ignore $PWD?\n> cd -P ... does the trick.  IIRC it's in SUSv3, but once more, Solaris\n> /bin/sh doesn't know about that option:\n> \n> \tlogin@~ > uname -a\n> \tSunOS login 5.10 Generic_125100-10 sun4u sparc\n> \n> \tlogin@~ > /bin/sh\n> \n> \t$ mkdir /tmp/foo; cd /tmp/foo\n> \n> \t$ git init\n> \tInitialized empty Git repository in .git/\n> \n> \t$ mkdir -p a/b; ln -s a/b c; cd c\n> \n> \t$ git rev-parse --show-cdup\n> \t../../\n> \n> \t$ cd -P ../../\n> \t-P: does not exist\n\nDo we care about that shell?  There was another thread about shell\nscript cleanup where the default sun /bin/sh doesn't support some\nother features from the git shell scripts too.\n"},{"id":"50123","messageId":"20070807124526.GA11230@informatik.uni-freiburg.de","threadId":"9411","inReplyTo":"20070807101155.GA19233@moooo.ath.cx","subject":"Re: git-sh-setup.sh:cd_to_toplevel problematic with symlinks","fromName":"Uwe Kleine-König","fromEmail":"ukleinek@informatik.uni-freiburg.de","sentAt":"2007-08-07T12:45:26Z","receivedAt":"2007-08-07T12:45:26Z","isPatch":false,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello Matthias,\n\nMatthias Lederhofer wrote:\n> Your mail did not make it to the list, therefore I quote the full\n> mail.\nOps, thanks.\n\n> Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> wrote:\n> > > Is there any way to tell cd to ignore $PWD?\n> > cd -P ... does the trick.  IIRC it's in SUSv3, but once more, Solaris\n> > /bin/sh doesn't know about that option:\n> > \n[...]\n> \n> Do we care about that shell?  There was another thread about shell\n> script cleanup where the default sun /bin/sh doesn't support some\n> other features from the git shell scripts too.\nAh, I see, Makefile defines SHELL_PATH for SunOS to /bin/bash anyhow.\n\nOK, then maybe just use it and if it breaks for someone we will notice\nit ...\n\nBest regards\nUwe\n\n-- \nUwe Kleine-König\n\nhttp://www.google.com/search?q=12+mol+in+dozen\n"}]}