On 4/26/07, koreth@midwinter.com [off-list ref] wrote:
I have a symlink pointing to a subdirectory of a repo of mine. If I cd
to that symlink, some shell-script git commands don't work. Shell scripts
use the PWD environment variable as the working directory, and the chain
of "../"s from git-rev-parse --show-cdup just peels entries off that
variable. That's fine when PWD is a real path, but not so great when it's
a reference to a symlink from an outside directory.
Your implementation will fail if cwd is longer than PATH_MAX.
Does not happen often, though.
A typical failure case:
$ git clone git://whatever.git foobar
$ ln -s foobar/src/tools/misc/myapp myapp
$ cd myapp
Which is a strange thing to do. What is that for?
myapp is kind of outside the git repo foobar.