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

rev-parse --show-cdup in .git

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Dec 4, 2009, 15:45 UTC
Message-ID
<4B192EAE.8000806@drmicha.warpmail.net>
I'm sure this was discussed somewhere, but I can't find it:

When called from within .git, git rev-parse --show-cdup returns nothing rather than "..", not even an error code. Is this intended?

This is all the more disturbing since the cwd of hooks seems to be GIT_DIR. Is that something one can rely upon? In that case one can simply use ".." for cdup.

Michael

P.S.: The use case is a simple post-receive-hook that fast forwards a checked out branch on receiving refs in refs/remotes/incoming/, but needs to check the worktree against the index etc. 1.7.0 may be an opportunity to encourage usage of this rather than restoring the old behavior through options.

Next: Junio C Hamano
Message 1 of 3 in “rev-parse --show-cdup in .git”
  1. Michael J GruberDec 4, 2009
  2. Junio C HamanoDec 4, 2009
  3. Michael J GruberDec 5, 2009

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.