From 7c17a3abdb86c9c8399c2930a5127b4c9c643bd2 Mon Sep 17 00:00:00 2001 From: Li Linchao Date: Sun, 17 Jul 2022 12:01:08 +0800 Subject: [PATCH 1/4] 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 a0140c019..046e1f5dd 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 worklow or process between `pre-reveive` and +`post-receive` script. 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`. 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 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. From ebfde44217ccce7e24ded4e504142da42bf9d6aa Mon Sep 17 00:00:00 2001 From: Li Linchao Date: Sun, 31 Jul 2022 23:55:52 +0800 Subject: [PATCH 2/4] Update book/08-customizing-git/sections/hooks.asc Co-authored-by: Dexter --- book/08-customizing-git/sections/hooks.asc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/08-customizing-git/sections/hooks.asc b/book/08-customizing-git/sections/hooks.asc index 046e1f5dd..fff6dc666 100644 --- a/book/08-customizing-git/sections/hooks.asc +++ b/book/08-customizing-git/sections/hooks.asc @@ -116,7 +116,7 @@ You can use this hook to do things like make sure none of the updated references The `proc-receive` script is quite different from other server-side scripts, it is invoked by git push process, but can change the worklow or process between `pre-reveive` and `post-receive` script. 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`. 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 Git. +In other words, it can outsource reference processing flow, this gives a system administrator to customize a very useful policy for pushing workflow, such as Gerrit-like workflow in Git. This script runs once at push process, and can stop the push process. ===== `update` From 3dbabae303ea2ffffbcf32337603380ce061851a Mon Sep 17 00:00:00 2001 From: Li Linchao Date: Mon, 1 Aug 2022 10:26:43 +0800 Subject: [PATCH 3/4] update: keep one sentence per one line --- book/08-customizing-git/sections/hooks.asc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/book/08-customizing-git/sections/hooks.asc b/book/08-customizing-git/sections/hooks.asc index fff6dc666..eb832c307 100644 --- a/book/08-customizing-git/sections/hooks.asc +++ b/book/08-customizing-git/sections/hooks.asc @@ -113,9 +113,9 @@ You can use this hook to do things like make sure none of the updated references ===== `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 worklow or process between `pre-reveive` and -`post-receive` script. 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`. It can decide to create, update or rename new reference, or even fallback to previous process. +The `proc-receive` script is quite different from other server-side scripts, it is invoked by git push process, but can change the worklow or process between `pre-reveive` and `post-receive` script. +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`. +It can decide to create, update or rename new reference, or even fallback to previous process. In other words, it can outsource reference processing flow, this gives a system administrator to customize a very useful policy for pushing workflow, such as Gerrit-like workflow in Git. This script runs once at push process, and can stop the push process. From 0cf5170c0ce04b9406b7bdafcede71d8e2d40bcf Mon Sep 17 00:00:00 2001 From: Li Linchao Date: Sat, 11 Feb 2023 19:49:13 +0800 Subject: [PATCH 4/4] Update book/08-customizing-git/sections/hooks.asc Co-authored-by: Ben Straub --- book/08-customizing-git/sections/hooks.asc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/book/08-customizing-git/sections/hooks.asc b/book/08-customizing-git/sections/hooks.asc index eb832c307..68cf42349 100644 --- a/book/08-customizing-git/sections/hooks.asc +++ b/book/08-customizing-git/sections/hooks.asc @@ -113,11 +113,13 @@ You can use this hook to do things like make sure none of the updated references ===== `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 worklow or process between `pre-reveive` and `post-receive` script. -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`. -It can decide to create, update or rename new reference, or even fallback to previous process. -In other words, it can outsource reference processing flow, this gives a system administrator to customize a very useful policy for pushing workflow, such as Gerrit-like workflow in Git. -This script runs once at push process, and can stop the push process. +The `proc-receive` script is quite different from other server-side scripts. +It is invoked by git push process, but can change the worklow or process between `pre-receive` and `post-receive` script. +If the incoming update references match the specified reference pattern (`receive.procReceiveRefs`), then `proc-receive` will take over the whole flow after `pre-receive`. +It can decide to create, update or rename new reference, or even fall back to previous process. + +In other words, it can outsource reference processing flow. +This gives a system administrator the ability to customize a pushing workflow, like that used in a Gerritt project. ===== `update`