On 3/20/24 18:43, Skyler Ferris wrote:
That gave me pause too, but I tested it with a pull that caused a
fast-forward (no separate merge commit) and it still ran the hook.
I looked for a `post-fetch` hook but couldn't find one, I agree
that would be ideal.
It turns out that a post-fetch hook has been discussed on the git
mailing list. Notably, someone asked about it for a very similar
use-case starting at (1). Much of the discussion is about the way
this person implemented the hook, because they wanted to prevent
refs from being updated instead of simply alerting the user of the
potentially bad commits. There is also a categorical objection to
the idea of implementing a post-fetch hook (2), in part because
modifying refs could lead to problems for the environment (such as
clients re-fetching, then rejecting, the same commits repeatedly
leading to excess bandwidth use) (3). In spite of this, there are
WIP patches at the end of the thread implementing a tweak-fetch hook
at the end of the thread (4), but I don't think they were ever
completed... haven't looked at those too closely yet but maybe
there's something somewhere else about them.
(1)
https://lore.kernel.org/git/5898be69-4211-d441-494d-93477179cf0e@gaspard.io/
(2)
https://lore.kernel.org/git/25bd770c-6a48-5b5d-04cc-6d02784ea3e7@gaspard.io/
(3) https://lore.kernel.org/git/87lgg1bwmi.fsf@evledraar.gmail.com/
(4)
https://lore.kernel.org/git/30753d19-d77d-1a1a-ba42-afcd6fbb4223@gaspard.io/