Subject: Re: receive.denyCurrentBranch=updateInstead won't update the repo

From: Junio C Hamano <[email-masked]>
Date: Tue, 18 Jul 2023 15:28:54 -0700

"Adam \"Sinus\" Skawiński"  <[email-masked]> writes:

> Correct me if I'm wrong, but I'm looking at receive-pack.c and can't
> grasp one thing.
>
> In receive-pack.c:1452-1453,
>> if (!invoked_hook)
>>   retval = push_to_deploy(sha1, &env, worktree->path);
> ... push_to_deploy is reached only if... hook didn't get invoked?

Correct.  The hook is responsible for both DECIDING if it wants to
touch/update the working tree, AND ACTUALLY UPDATING the working
tree itself.

And the entire point of the "hook" is that its update does not have
to be just "checkout the given commit's tree", for which using the
default push-to-deply is sufficient.  It is for those who want to do
more.