Skip to content

Commit

Permalink
add server-side hook: proc-receive
Browse files Browse the repository at this point in the history
  • Loading branch information
Li Linchao committed Jul 17, 2022
1 parent 258c9a1 commit e6649bf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions book/08-customizing-git/sections/hooks.asc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit e6649bf

Please sign in to comment.