Thread (1 message) 1 message, 1 author, 2024-10-14

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

From: Patrick Steinhardt <hidden>
Date: 2024-10-14 12:25:32

On Fri, Oct 11, 2024 at 12:09:18PM +0200, Gabriel Nützi wrote:
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help