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

rev-parse's show-{cdup,prefix} inconsistent when pwd symlink

From
OFOliver Ford <dev@ojford.com>
Date
Jul 7, 2019, 15:36 UTC
Message-ID
<2cf30314-d9a3-4be3-80bf-46f283010e5d@www.fastmail.com>
`git rev-parse --show-prefix` gives the symlinked directory, not pwd:

``` $ git init Initialized empty Git repository in [~]/git-test/.git/ $ mkdir realdir $ ln -s realdir symdir $ cd symdir $ pwd [~]/misc/git-test/symdir $ git rev-parse --show-prefix realdir/ ```

That might arguably be desirable, (though not in my prompt) but I don't think this is:

``` $ cd .. $ mkdir realdir/2 $ ln -s realdir/2 symdir2 $ cd symdir2 $ pwd [~]/misc/git-test/symdir2 $ git rev-parse --show-cdup ../../ ```

that is, `--show-cdup` gives a 'cd up' that is incorrect for where we actually are.
Apologies if I've just missed an option,
-- 
Oliver Ford
Message 1 of 1 in “rev-parse's show-{cdup,prefix} inconsistent when pwd symlink”
  1. Oliver FordJul 7, 2019

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.