From: Alex Riesen Date: Thu, 26 Apr 2007 08:20:29 GMT Subject: Re: [PATCH] Change git-rev-parse --show-cdup to output an absolute path Message-ID: <81b0412b0704260120mda8a2abhe343f5c127945939@mail.gmail.com> In-Reply-To: <20070425232829.GA15930@midwinter.com> On 4/26/07, koreth@midwinter.com 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.