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