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

Re: [PATCH] Change git-rev-parse --show-cdup to output an absolute path

From
Alex Riesen <raa.lkml@gmail.com>
Date
Apr 26, 2007, 08:20 UTC
Message-ID
<81b0412b0704260120mda8a2abhe343f5c127945939@mail.gmail.com>
In-Reply-To
<20070425232829.GA15930@midwinter.com>
On 4/26/07, koreth@midwinter.com <koreth@midwinter.com> wrote:
Show 6 quoted lines
> 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.

Show 5 quoted lines
> 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.

Previous: koreth@midwinter.comNext: Steven Grimm
Message 2 of 6 in “Change git-rev-parse --show-cdup to output an absolute path”
  1. Change git-rev-parse --show-cdup to output an absolute pathkoreth@midwinter.com, Apr 25, 2007
  2. Alex RiesenApr 26, 2007
  3. Steven GrimmApr 26, 2007
  4. Use PATH_MAX rather than a hardwired constant maximum length.koreth@midwinter.com, Apr 26, 2007
  5. Alex RiesenApr 26, 2007
  6. Alex RiesenApr 26, 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.