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

git-rev-parse --show-cdup returns a relative path instead of absolute (problem with git pull --rebase not finding the git dir)

From
YOYves Orton <yves.orton@booking.com>
Date
Jul 15, 2008, 14:13 UTC
Message-ID
<1216131208.19334.171.camel@gemini>
Hi,

Im reporting this based on a conversation I had in the #git channel on freenode.

I have a setup where various subdirectories of a number of git repos are symlinked into a common directory tree. Something like what the following would create but with more repositories involved:

cd ~; mkdir foo; chdir foo; git init; mkdir bar; git add bar ; git commit -m'add bar' ; cd ~; ln -s foo/bar bar ; cd bar;

[try various git commands, not all will work]

Most git command seem perfectly happy to work on the correct repos from this symlinked tree. However at least one doesnt, git pull --rebase, in particular.

Doing a 
	git-rev-parse --git-dir 
seems to behave correctly (always finding the correct location) and 
	git-rev-parse --is-inside-work-dir

reports true. However git-pull --rebase responds with lots of "fatal: Not a git repository" messages. Example is below.

During discussion about this on #git it was suggested this was because 
	git-rev-parse --show-cdup 
returns a relative path. (../).

Im not on list so id appreciate it if anyone replying to this could cc me on the mail.

Oh, i am aware of submodules but i have to work with what i have now. 

Cheers, yves

Example of git pull --rebase failing yet git commit working:
[dmq@somewhere apps]$ echo test > test.txt
[dmq@somewhere apps]$ git add test.txt
[dmq@somewhere apps]$ git commit -m'add a test file -- will remove next
commit'
Created commit 45ab725: add a test file -- will remove next commit
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 apps/test.txt
[dmq@somewhere apps]$ git rm test.txt
rm 'apps/test.txt'
[dmq@somewhere apps]$ git commit -m'removed test file'
Created commit 2768e6d: removed test file
 1 files changed, 0 insertions(+), 1 deletions(-)
 delete mode 100644 apps/test.txt
[dmq@somewhere apps]$ git pull --rebase
fatal: Not a git repository
fatal: Not a git repository
fatal: Not a git repository
fatal: Not a git repository
Next: Petr Baudis
Message 1 of 8 in “git-rev-parse --show-cdup returns a relative path instead of absolute (problem with git pull --rebase not finding the git dir)”
  1. Yves OrtonJul 15, 2008
  2. git rev-parse: Fix --show-cdup inside symlinked directoryPetr Baudis, Jul 15, 2008
  3. Johannes SchindelinJul 15, 2008
  4. Petr BaudisJul 15, 2008
  5. Yves OrtonJul 15, 2008
  6. Yves OrtonJul 15, 2008
  7. Rogan DawesJul 15, 2008
  8. Yves OrtonJul 15, 2008

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.