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

Re: Bug: `git init` with hook `reference-transaction` running `git rev-parse --git-dir` fails

From
Patrick Steinhardt <ps@pks.im>
Date
Oct 14, 2024, 12:25 UTC
Message-ID
<Zw0NskRJUSmpNxLe@pks.im>
In-Reply-To
<B0631C6D-0914-4C25-AAF7-E742129836FC@gmail.com>
On Fri, Oct 11, 2024 at 12:09:18PM +0200, Gabriel Nützi wrote:
Show 10 quoted lines
> > namely by checking whether the HEAD file exists in the Git directory. 
> 
> The problem here is the chicken-egg problem: How do I know inside a
> hook where to look for HEAD, so the non. env. way of doing this would
> be 'git rev-parse —git-dir' which crahshes… So there should be cleary
> some better way of knowing if a Git repo is on the way of beeing
> created, and when it is fully initialized. What about
> GIT_DIR_INITIALIZING and this variable does not exist once it is done
> or whats about making ‚git rev-parse —git-dir‘ not panic if the env.
> variables are defined. I guess for a good solution we need both?

Our documentation in githooks(5) says that the GIT_DIR environment variable is always set so that the hook can identify the location of the Git repository. So I'd argue that using git-rev-parse(1) is unnecessary in the first place. Or am I missing something?

Patrick
Previous: Junio C Hamano
Message 14 of 14 in “Bug: `git init` with hook `reference-transaction` running `git rev-parse --git-dir` fails”
  1. Gabriel NütziSep 20, 2024
  2. Gabriel NütziSep 20, 2024
  3. Patrick SteinhardtOct 7, 2024
  4. Gabriel NütziOct 7, 2024
  5. Patrick SteinhardtOct 7, 2024
  6. Gabriel NütziOct 7, 2024
  7. Patrick SteinhardtOct 7, 2024
  8. Junio C HamanoOct 7, 2024
  9. Patrick SteinhardtOct 9, 2024
  10. Karthik NayakOct 9, 2024
  11. Gabriel NütziOct 9, 2024
  12. Patrick SteinhardtOct 9, 2024
  13. Junio C HamanoOct 9, 2024
  14. Patrick SteinhardtOct 14, 2024

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.