summaryrefslogtreecommitdiffstats
path: root/githooks.html
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-09-25 15:50:12 -0700
committerJunio C Hamano <gitster@pobox.com>2020-09-25 15:50:12 -0700
commitc562f6d6447ae8aaa1066a8f3872de759638a6bc (patch)
tree9c3f0b788be8b8046c48ad4ffd901935941a9164 /githooks.html
parentb89e21bf03b9675dec757d6e63db8d859b034303 (diff)
downloadgit-htmldocs-c562f6d6447ae8aaa1066a8f3872de759638a6bc.tar.gz
Autogenerated HTML docs for v2.28.0-618-g9bc23
Diffstat (limited to 'githooks.html')
-rw-r--r--githooks.html65
1 files changed, 64 insertions, 1 deletions
diff --git a/githooks.html b/githooks.html
index 29c5b03bd..9264d2e39 100644
--- a/githooks.html
+++ b/githooks.html
@@ -1037,6 +1037,69 @@ for the user.</p></div>
unannotated tags to be pushed.</p></div>
</div>
<div class="sect2">
+<h3 id="proc-receive">proc-receive</h3>
+<div class="paragraph"><p>This hook is invoked by <a href="git-receive-pack.html">git-receive-pack(1)</a>. If the server has
+set the multi-valued config variable <code>receive.procReceiveRefs</code>, and the
+commands sent to <em>receive-pack</em> have matching reference names, these
+commands will be executed by this hook, instead of by the internal
+<code>execute_commands()</code> function. This hook is responsible for updating
+the relevant references and reporting the results back to <em>receive-pack</em>.</p></div>
+<div class="paragraph"><p>This hook executes once for the receive operation. It takes no
+arguments, but uses a pkt-line format protocol to communicate with
+<em>receive-pack</em> to read commands, push-options and send results. In the
+following example for the protocol, the letter <em>S</em> stands for
+<em>receive-pack</em> and the letter <em>H</em> stands for this hook.</p></div>
+<div class="literalblock">
+<div class="content">
+<pre><code># Version and features negotiation.
+S: PKT-LINE(version=1\0push-options atomic...)
+S: flush-pkt
+H: PKT-LINE(version=1\0push-options...)
+H: flush-pkt</code></pre>
+</div></div>
+<div class="literalblock">
+<div class="content">
+<pre><code># Send commands from server to the hook.
+S: PKT-LINE(&lt;old-oid&gt; &lt;new-oid&gt; &lt;ref&gt;)
+S: ... ...
+S: flush-pkt
+# Send push-options only if the 'push-options' feature is enabled.
+S: PKT-LINE(push-option)
+S: ... ...
+S: flush-pkt</code></pre>
+</div></div>
+<div class="literalblock">
+<div class="content">
+<pre><code># Receive result from the hook.
+# OK, run this command successfully.
+H: PKT-LINE(ok &lt;ref&gt;)
+# NO, I reject it.
+H: PKT-LINE(ng &lt;ref&gt; &lt;reason&gt;)
+# Fall through, let 'receive-pack' to execute it.
+H: PKT-LINE(ok &lt;ref&gt;)
+H: PKT-LINE(option fall-through)
+# OK, but has an alternate reference. The alternate reference name
+# and other status can be given in option directives.
+H: PKT-LINE(ok &lt;ref&gt;)
+H: PKT-LINE(option refname &lt;refname&gt;)
+H: PKT-LINE(option old-oid &lt;old-oid&gt;)
+H: PKT-LINE(option new-oid &lt;new-oid&gt;)
+H: PKT-LINE(option forced-update)
+H: ... ...
+H: flush-pkt</code></pre>
+</div></div>
+<div class="paragraph"><p>Each command for the <em>proc-receive</em> hook may point to a pseudo-reference
+and always has a zero-old as its old-oid, while the <em>proc-receive</em> hook
+may update an alternate reference and the alternate reference may exist
+already with a non-zero old-oid. For this case, this hook will use
+"option" directives to report extended attributes for the reference given
+by the leading "ok" directive.</p></div>
+<div class="paragraph"><p>The report of the commands of this hook should have the same order as
+the input. The exit status of the <em>proc-receive</em> hook only determines
+the success or failure of the group of commands sent to it, unless
+atomic push is in use.</p></div>
+</div>
+<div class="sect2">
<h3 id="post-receive">post-receive</h3>
<div class="paragraph"><p>This hook is invoked by <a href="git-receive-pack.html">git-receive-pack(1)</a> when it reacts to
<code>git push</code> and updates reference(s) in its repository.
@@ -1306,7 +1369,7 @@ running passing "1", "1" should not be possible.</p></div>
<div id="footer">
<div id="footer-text">
Last updated
- 2020-09-03 13:19:53 PDT
+ 2020-09-25 15:47:14 PDT
</div>
</div>
</body>