Re: receive.denyCurrentBranch=updateInstead won't update the repo
- From
- Adam Sinus Skawiński <adam.skawinski@sinpi.net>
- Date
- Jul 18, 2023, 22:49 UTC
- Message-ID
- <CAGE71k28Gao4xuR565qsLmPH02tVAdoCZPeuCjo7r9YZXWs82Q@mail.gmail.com>
- In-Reply-To
- <xmqqa5vsg8gp.fsf@gitster.g>
Oh. Then it's different from the other hooks, which merely enhance or abort the default behaviour by returning non-zero! I hadn't thought of that. The documentation is phrased in a way that made me assume "This hook is to be used to override the default behaviour" means overriding the tree cleanliness checks, not replacing the whole deployment routine, which - if a hook is in place - needs to be fully reimplemented in the hook.
All in all, I'm glad it works now. Thank you for the explanation, I shall bother you no more. :)
On Wed, 19 Jul 2023 at 00:29, Junio C Hamano <gitster@pobox.com> wrote:
Show 19 quoted lines
> > "Adam \"Sinus\" Skawiński" <adam.skawinski@sinpi.net> 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.
-- Adam "Sinus" Skawiński