doc: clarify post-receive hook behavior

The `githooks` documentation mentions that the post-receive hook executes once after git-receive-pack(1) updates all references and that it also receives the same information as the pre-receive hook on standard input. This is misleading though because the hook only executes once if at least one of the attempted reference updates is successful. Also, while each line provided on standard input is in the same format as the pre-receive hook, the information received only includes the set of references that were successfully updated. Update the documentation to clarify these points and also provide a reference to the post-receive hook section of the `git-receive-pack` documentation which has additional information. Signed-off-by: Justin Tobler <jltobler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Justin Tobler committed Jul 15, 2024 at 13:37 UTC 8db8786fc2de36731738fd480d1df422c6e86579
1 file changed +9 -6
Documentation/githooks.txt
+9 -6
@@ -415,13 +415,13 @@ post-receive
415
416 This hook is invoked by linkgit:git-receive-pack[1] when it reacts to
417 `git push` and updates reference(s) in its repository.
418 -It executes on the remote repository once after all the refs have
419 -been updated.
418 +The hook executes on the remote repository once after all the proposed
419 +ref updates are processed and if at least one ref is updated as the
420 +result.
421
421 -This hook executes once for the receive operation. It takes no
422 -arguments, but gets the same information as the
423 -<<pre-receive,'pre-receive'>>
424 -hook does on its standard input.
422 +The hook takes no arguments. It receives one line on standard input for
423 +each ref that is successfully updated following the same format as the
424 +<<pre-receive,'pre-receive'>> hook.
425
426 This hook does not affect the outcome of `git receive-pack`, as it
427 is called after the real work is done.
@@ -448,6 +448,9 @@ environment variables will not be set. If the client selects
448 to use push options, but doesn't transmit any, the count variable
449 will be set to zero, `GIT_PUSH_OPTION_COUNT=0`.
450
451 +See the "post-receive" section in linkgit:git-receive-pack[1] for
452 +additional details.
453 +
454 [[post-update]]
455 post-update
456 ~~~~~~~~~~~