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@xxxxxxxxx> wrote: > > "Adam \"Sinus\" Skawiński" <adam.skawinski@xxxxxxxxx> 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