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

GIT_DIR=. for hooks?

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Jan 6, 2010, 13:55 UTC
Message-ID
<4B44965F.8040803@drmicha.warpmail.net>
Hi there,

as it seems hooks (at least post-receive) are called with a $PWD in the .git dir and GIT_DIR=. exported.

Now, that leads to problems when, say, diffing between the index and the worktree ("Don't do that!", I know). Without cd'ing around, the worktree is not found, and after "cd ..", the git-dir is not found.

I can unset GIT_DIR or set WORK_TREE, of course, but I'm wondering whether GIT_DIR=. is a sane setting at all: a git-dir in $PWD is always found, and when cd'ing away that setting does not help either.

Michael
Next: Junio C Hamano
Message 1 of 2 in “GIT_DIR=. for hooks?”
  1. Michael J GruberJan 6, 2010
  2. Junio C HamanoJan 6, 2010

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.