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

Re: [PATCH] update-hook: remove all functionality that should be in hooks/post-receive

From
Shawn O. Pearce <spearce@spearce.org>
Date
Mar 25, 2007, 09:25 UTC
Message-ID
<20070325092530.GI25863@spearce.org>
In-Reply-To
<200703251011.53712.andyparkins@gmail.com>
Andy Parkins <andyparkins@gmail.com> wrote:
Show 9 quoted lines
> On Saturday 2007, March 24, Francis Moreau wrote:
> 
> > yes that almost would do the thing. But instead of hacking the hook,
> > it would be great to have a trivial setup at the begining of the
> > script to choose this config.
> 
> I'd like Junio's permission before actually doing that; I know he is 
> worried about out-of-control growth of hook scripts and it's already 
> overly large just to do the one job it's got.
One thought I had today:

The old hooks (update, post-update) were easy to chain if you wanted to run more than one "standard" hook in a repository. Just pass "$@" to each hook excutable, using a small shell-script wrapper that is installed as the actual hook.

The new hooks (pre-receive, post-receive) are not so easy to chain, as their input comes by way of stdin. You'd have to copy the data off to a temporary file, and redirect that into each hook in turn. Annoying.

So I'm kicking around the idea of teaching receive-pack to run hooks in filename order if the hook is actually a subdirectory. Then you can do:

  mkdir .git/hooks/post-receive
  ln -s \
    ~/git/contrib/email/post-receive-head \
    .git/hooks/post-receive/01-head
  ln -s \
    ~/git/contrib/email/post-receive-tag \
    .git/hooks/post-receive/02-tag
  ln -s \
    ~/git/contrib/continuous/post-receive-cinotify \
    .git/hooks/post-receive/10-cinotify

Where this applies to Andy's message that I quoted is the email hooks could be split up to handle different types of refs in each hook, e.g. one for heads and one for tags, and just skip refs that don't apply to that particular hook.

-- 
Shawn.
Previous: Andy ParkinsNext: Francis Moreau
Message 14 of 15 in “update-hook: remove all functionality that should be in hooks/post-receive”
  1. update-hook: remove all functionality that should be in hooks/post-receiveAndy Parkins, Mar 23, 2007
  2. Junio C HamanoMar 24, 2007
  3. Linus TorvaldsMar 24, 2007
  4. Shawn O. PearceMar 24, 2007
  5. Andy ParkinsMar 24, 2007
  6. Theodore TsoMar 24, 2007
  7. Junio C HamanoMar 24, 2007
  8. Andy ParkinsMar 24, 2007
  9. Theodore TsoMar 24, 2007
  10. Francis MoreauMar 24, 2007
  11. Andy ParkinsMar 24, 2007
  12. Francis MoreauMar 24, 2007
  13. Andy ParkinsMar 25, 2007
  14. Shawn O. PearceMar 25, 2007
  15. Francis MoreauMar 25, 2007

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.