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

From: Patrick Steinhardt <[email-masked]>
Date: Mon, 7 Oct 2024 12:57:19 +0200

On Mon, Oct 07, 2024 at 12:54:36PM +0200, Gabriel Nützi wrote:
> Hi Patrick,
> 
> Thanks for clarifications!
> Could it work if for (2) -> call the reference-transaction hook after the HEAD has been initialized, meaning that Git would internally cache the
> different reference transactions and then call the hooks in one go at once after the creation of the repo, such that it is initialized properly?
> This might be probably a more elaborate change which introduces too many technicalities?

That would break basic assumptions of how the hook operates. It is
expected that we abort the transaction when the hook returns an error,
so if we were to run the hook _after_ `HEAD` has been created that
expectation would be broken.

So the only viable solution is to create a stub `HEAD`, but as said I'm
not a 100% sure whether we want to go there or not.

Patrick