git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
ASAdam 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
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 9 in “receive.denyCurrentBranch=updateInstead won't update the repo”
  1. Adam Sinus SkawińskiJul 17, 2023
  2. Junio C HamanoJul 17, 2023
  3. Junio C HamanoJul 17, 2023
  4. Adam Sinus SkawińskiJul 17, 2023
  5. Adam Sinus SkawińskiJul 18, 2023
  6. Junio C HamanoJul 18, 2023
  7. Adam Sinus SkawińskiJul 18, 2023
  8. Junio C HamanoJul 18, 2023
  9. Adam Sinus SkawińskiJul 18, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.