@@ -333,6 +333,76 @@ The default 'update' hook, when enabled--and with
333
333
`hooks.allowunannotated` config option unset or set to false--prevents
334
334
unannotated tags to be pushed.
335
335
336
+ [[proc-receive]]
337
+ proc-receive
338
+ ~~~~~~~~~~~~
339
+ This hook is invoked by linkgit:git-receive-pack[1] when it reacts to
340
+ special `git push` command. According to refnames of the commands which
341
+ `git push` sends to 'git-receive-pack', the commands will be devided
342
+ into two groups by matching what the `receive.procReceiveRefs`
343
+ configuration variable defines. One group of the commands will execute
344
+ the internal `execute_commands` function to update the corresponding
345
+ refnames, and the other group of commands which have matching refnames
346
+ will execute this 'proc-receive' hook to create pull requests, etc.
347
+ If there is no `receive.procReceiveRefs` settings, this hook won't
348
+ execute at all, and all commands are sent to the internal
349
+ `execute_commands` function.
350
+
351
+ Its exit status only determines the success or failure of the group of
352
+ commands with special refnames, unless atomic push is in use.
353
+
354
+ This hook executes once for the receive operation. It takes no
355
+ arguments, but will talk a protocol in pkt-line format with the
356
+ 'receive-pack' for reading commands, push-options (optional), and
357
+ sending result. In the following example, The letter "S" stands for
358
+ "receive-pack" and letter "H" stands for the hook.
359
+
360
+ # Version and capabilities negotiation.
361
+ S: PKT-LINE(version=1\0push-options atomic...)
362
+ S: flush-pkt
363
+ H: PKT-LINE(version=1\0push-options...)
364
+ H: flush-pkt
365
+
366
+ # Send commands from server to the hook.
367
+ S: PKT-LINE(old-oid new-oid ref)
368
+ S: ... ...
369
+ S: flush-pkt
370
+ # Only if push-options have been negotiated.
371
+ S: PKT-LINE(push-option)
372
+ S: ... ...
373
+ S: flush-pkt
374
+
375
+ # Receive result from the hook.
376
+ # OK, run this command successfully.
377
+ H: PKT-LINE(old-oid new-oid ref ok)
378
+ # NO, I reject it.
379
+ H: PKT-LINE(old-oid new-oid ref ng reason)
380
+ # OK, but use an alternate reference.
381
+ H: PKT-LINE(old-oid new-oid ref ok ref:alt-ref)
382
+ # It will fallthrough to receive-pack to execute.
383
+ H: PKT-LINE(old-oid new-oid ref ft)
384
+ H: ... ...
385
+ H: flush-pkt
386
+
387
+ The "proc-receive" hook may update one or more references, and will send
388
+ its result one by one in pkt-line format. Each line of the result has
389
+ four fields and one optional message field, like "<old-oid> <new-oid>
390
+ <ref> <status> [<message>]".
391
+
392
+ The first three fields are the same as those of the commands for
393
+ "receive-pack".
394
+
395
+ The forth field has a two-letter status code. Available status codes:
396
+
397
+ * ok: The command runs successfully. If the optional message has a
398
+ prefix "ref:", the hook has created/updated an alternate reference
399
+ instead.
400
+
401
+ * ng: Fail to run the command. Error message is given in the optional
402
+ message field.
403
+
404
+ * ft: Will fallthrough to receive-pack to execute.
405
+
336
406
[[post-receive]]
337
407
post-receive
338
408
~~~~~~~~~~~~
0 commit comments