From e6649bf9f04641a957eb9f0a2a6314dfdcaef731 Mon Sep 17 00:00:00 2001 From: Li Linchao Date: Sun, 17 Jul 2022 12:01:08 +0800 Subject: [PATCH] add server-side hook: proc-receive --- book/08-customizing-git/sections/hooks.asc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/book/08-customizing-git/sections/hooks.asc b/book/08-customizing-git/sections/hooks.asc index a0140c0191..98fc44c8d2 100644 --- a/book/08-customizing-git/sections/hooks.asc +++ b/book/08-customizing-git/sections/hooks.asc @@ -111,6 +111,14 @@ The first script to run when handling a push from a client is `pre-receive`. It takes a list of references that are being pushed from stdin; if it exits non-zero, none of them are accepted. You can use this hook to do things like make sure none of the updated references are non-fast-forwards, or to do access control for all the refs and files they're modifying with the push. +===== `proc-receive` + +The `proc-receive` script is quite different from other server-side scripts, it is invoked by git push process, but can change the workflow or process between `pre-reveive` and `post-receive` hook. +This's because if the upcoming update references match the specified reference pattern, which can be configured by `receive.procReceiveRefs`, then `proc-receive` will take over the whole flow +after `pre-receive`, then ignore the `update` script. It can decide to create, update or rename new reference, or even fallback to previous process. +In other word, it can outsource reference processing flow, this give a system administrator to customize very useful policy for pushing workflow, such as Gerrit-like workflow in native Git. +This script runs once at push process, and can stop the push process. + ===== `update` The `update` script is very similar to the `pre-receive` script, except that it's run once for each branch the pusher is trying to update.