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

RE: Inconsistent results from git rev-parse --show-toplevel

From
CACrabtree, Andrew <andrew.crabtree@hpe.com>
Date
Jan 25, 2020, 22:22 UTC
Message-ID
<TU4PR8401MB1117E8EEB853728B0392D83CF9090@TU4PR8401MB1117.NAMPRD84.PROD.OUTLOOK.COM>
In-Reply-To
<20200125195319.GA5519@coredump.intra.peff.net>
> But the bigger thing, I think, is: who is setting GIT_DIR but not setting GIT_WORK_TREE to match? Because IMHO that's the situation that is causing the confusion.
Pre-commit hook when worktrees are used? 

pre-commit #!/bin/bash env | grep GIT

/tmp/pre_commit_test_worktree  (new_branch)$ git add frob
/tmp/pre_commit_test_worktree  (new_branch)$ git commit -m "frob"
GIT_DIR=/tmp/pre_commit_test/.git/worktrees/pre_commit_test_worktree
GIT_EDITOR=:
GIT_INDEX_FILE=/tmp/pre_commit_test/.git/worktrees/pre_commit_test_worktree/index
GIT_PREFIX=
GIT_AUTHOR_DATE=@1579990789 -0800
GIT_AUTHOR_NAME=Andrew Crabtree
GIT_EXEC_PATH=/usr/local/libexec/git-core
GIT_AUTHOR_EMAIL=andrew.crabtree@hpe.com
[new_branch 7b1b747] frob
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 frob
Previous: Jeff KingNext: Jeff King
Message 5 of 8 in “Inconsistent results from git rev-parse --show-toplevel”
  1. Crabtree, AndrewJan 24, 2020
  2. Junio C HamanoJan 24, 2020
  3. Crabtree, AndrewJan 25, 2020
  4. Jeff KingJan 25, 2020
  5. Crabtree, AndrewJan 25, 2020
  6. Jeff KingJan 30, 2020
  7. Crabtree, AndrewJan 30, 2020
  8. Jeff KingFeb 14, 2020

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.