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

Re: [PATCH] [RFC] Make git-update-ref invoke the update and post-update hooks

From
BVBrian Vandenberg <phantall@gmail.com>
Date
Jun 15, 2015, 19:49 UTC
Message-ID
<CAEJ-0i-BB=5W-Ah3nkeLFCe5-4XW4CvYaDgdqv1mMp4UGF81qw@mail.gmail.com>
From: Junio C Hamano <junkio@cox.net>
Date: 2006-10-08 15:00:32
Petr Baudis <pasky@suse.cz> writes:
Show 8 quoted lines
>> Someone raised a concern that the update and post-update hooks are not
>> invoked at fetch time in the similar way as they are invoked at push
>> time, and the idea sort of makes sense. But this patch goes further - it
>> makes Git invoke those hooks each time a ref is updated in a repository
>> using the git-update-ref command, which I believe makes a lot of sense as
>> well - the behaviour is consistent with the current pushing behaviour
>> and you suddenly finally get a hook where you can properly notify even
>> about fast-forwards etc.
Show 7 quoted lines
>In principle I do not have problem with this approach per-se,
>but I wonder if we were to do this we might want to make
>receive-pack.c::update() and cmd_update_ref() call the same
>underlying function, and make that underlying function implement
>this "ask the hook if updating is ok" dance.  It might even make
>sense to have update-ref honor deny_non_fast_forwards for that
>matter (I am mildly doubtful of this last point, though).
Was this rejected?

I'm tweaking the configuration on our master repo; among other things: I've enabled reflog and disabled altering history or deleting branches through receive-pack, instead requiring that someone make history alterations directly (using update-ref).

update-ref can optionally accept a comment explaining why the history needed to be altered, but we would prefer to make it mandatory. Hooks seem like a natural place to do that, but after running update-ref under strace/truss & looking through builtin/update-ref.c, it looks as though it doesn't make use of hooks.

-Brian
Next: Junio C Hamano
Message 1 of 5 in “Re: [PATCH] [RFC] Make git-update-ref invoke the update and post-update hooks”
  1. Brian VandenbergJun 15, 2015
  2. Junio C HamanoJun 15, 2015
  3. Brian VandenbergJun 15, 2015
  4. Junio C HamanoJun 15, 2015
  5. Brian VandenbergJun 16, 2015

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.