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

Re: [RTC/PATCH] Add 'update-branch' hook

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Apr 24, 2014, 01:11 UTC
Message-ID
<535864bbc3a84_3c7abff3107b@nysa.notmuch>
In-Reply-To
<xmqqoazrwtsc.fsf@gitster.dls.corp.google.com>
Junio C Hamano wrote:
Show 31 quoted lines
> Felipe Contreras <felipe.contreras@gmail.com> writes:
> 
> >> >> I have a branch which should always be recompiled on update;
> >> >> post-update-branch would be a good place for that.
> >> >
> >> > And why would pre-update-branch not serve that purpose?
> >> 
> >> Because the code that needs to be compiled is not yet in the workspace
> >
> > And it won't be in 'post-update-branch' either.
> >
> >  % git checkout master
> >  % git branch feature-a stable
> >  <- update-branch hook will be called here
> >
> > The hook will get 'feature-a' as the first argument, but the code in the
> > workspace would correspond to 'master'; the checked out branch (pre or post).
> 
> The whole point of a pre- hook is to run _before_ the externally
> observable state changes due to the operation.
> 
> If Stephen has a separate build-tree that fetches from the branch
> every time the tip of the branch changes in this repository to
> produce build artifacts for the branch to be shared in his network,
> perhaps via NFS or something.  "git fetch" that will be run from
> that build-tree repository will *not* see the tip of the branch, and
> running such a hook will not be possible from a pre-update-branch
> hook.
> 
> We can certainly argue that such a hook could instead push to the
> build-tree repository using the commit object name,
Exactly, it could do that.
> but I tend to think such an argument is merely sidestepping the real issue.

So you grant that there is no reason anybody can think of why we would ever want a post-update-branch?

> Some hooks do want to observe the state _after_ the operation [*1*], while
> some hooks can do without seeing exactly the state after the operation.

Yes, and when the operation is updating a branch, nobody can think of why we would want the former.

> So while I am generally not very supportive towards post-anything
> hook, I would reject a claim that says "pre-anything can be used
> without inventing post-anything---do the same thing and allow the
> operation and you are done".  That is not simply true.

Let's make a bet, we go for 'pre-update-branch' and five years from now, if there's no 'post-update-branch', you will publicly accept thta I was right.

Deal?
-- 
Felipe Contreras
Previous: Junio C HamanoNext: Junio C Hamano
Message 16 of 39 in “Add 'update-branch' hook”
  1. Add 'update-branch' hookFelipe Contreras, Apr 21, 2014
  2. Eric SunshineApr 21, 2014
  3. Ilya BobyrApr 21, 2014
  4. Felipe ContrerasApr 21, 2014
  5. Ilya BobyrApr 21, 2014
  6. Felipe ContrerasApr 21, 2014
  7. Ilya BobyrApr 21, 2014
  8. Felipe ContrerasApr 21, 2014
  9. Stephen LeakeApr 22, 2014
  10. Felipe ContrerasApr 22, 2014
  11. Ilya BobyrApr 22, 2014
  12. Felipe ContrerasApr 22, 2014
  13. Stephen LeakeApr 23, 2014
  14. Felipe ContrerasApr 23, 2014
  15. Junio C HamanoApr 23, 2014
  16. Felipe ContrerasApr 24, 2014
  17. Junio C HamanoApr 26, 2014
  18. Felipe ContrerasApr 26, 2014
  19. Stephen LeakeApr 24, 2014
  20. Felipe ContrerasApr 24, 2014
  21. Junio C HamanoApr 21, 2014
  22. Felipe ContrerasApr 21, 2014
  23. Junio C HamanoApr 21, 2014
  24. Felipe ContrerasApr 23, 2014
  25. Junio C HamanoApr 23, 2014
  26. Felipe ContrerasApr 24, 2014
  27. Ilya BobyrApr 22, 2014
  28. Felipe ContrerasApr 22, 2014
  29. Ilya BobyrApr 21, 2014
  30. Felipe ContrerasApr 21, 2014
  31. Ilya BobyrApr 21, 2014
  32. Felipe ContrerasApr 21, 2014
  33. Ilya BobyrApr 22, 2014
  34. Felipe ContrerasApr 22, 2014
  35. Felipe ContrerasApr 21, 2014
  36. Ilya BobyrApr 22, 2014
  37. Felipe ContrerasApr 22, 2014
  38. Ilya BobyrApr 22, 2014
  39. Felipe ContrerasApr 22, 2014

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.