Skip to content

Commit 24a0d61

Browse files
jan-hudecJunio C Hamano
authored andcommitted
Minor fixup to documentation of hooks in git-receive-pack.
Small additional changes to the cbb84e5 commit, which introduced documentation to pre-receive and post-receive: - Mention that stdout and stderr are equivalent. - Add one cross-section link and fix one other. - Fix information on advantages of post-receive over post-update. Signed-off-by: Jan Hudec <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6671525 commit 24a0d61

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

Documentation/hooks.txt

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,9 @@ If the hook exits with non-zero status, none of the refs will be
115115
updated. If the hook exits with zero, updating of individual refs can
116116
still be prevented by the <<update,'update'>> hook.
117117

118-
If you want to report something to the `git-send-pack` on the other end,
119-
you can simply `echo` your messages.
118+
Both standard output and standard error output are forwarded to
119+
`git-send-pack` on the other end, so you can simply `echo` messages
120+
for the user.
120121

121122
[[update]]
122123
update
@@ -153,9 +154,9 @@ Another use suggested on the mailing list is to use this hook to
153154
implement access control which is finer grained than the one
154155
based on filesystem group.
155156

156-
The standard output of this hook is sent to `stderr`, so if you
157-
want to report something to the `git-send-pack` on the other end,
158-
you can simply `echo` your messages.
157+
Both standard output and standard error output are forwarded to
158+
`git-send-pack` on the other end, so you can simply `echo` messages
159+
for the user.
159160

160161
The default 'update' hook, when enabled--and with
161162
`hooks.allowunannotated` config option turned on--prevents
@@ -171,17 +172,20 @@ It executes on the remote repository once after all the refs have
171172
been updated.
172173

173174
This hook executes once for the receive operation. It takes no
174-
arguments, but gets the same information as the `pre-receive`
175+
arguments, but gets the same information as the
176+
<<pre-receive,'pre-receive'>>
175177
hook does on its standard input.
176178

177179
This hook does not affect the outcome of `git-receive-pack`, as it
178180
is called after the real work is done.
179181

180-
This supersedes the [[post-update]] hook in that it actually get's
181-
both old and new values of all the refs.
182+
This supersedes the <<post-update,'post-update'>> hook in that it get's
183+
both old and new values of all the refs in addition to their
184+
names.
182185

183-
If you want to report something to the `git-send-pack` on the
184-
other end, you can simply `echo` your messages.
186+
Both standard output and standard error output are forwarded to
187+
`git-send-pack` on the other end, so you can simply `echo` messages
188+
for the user.
185189

186190
The default 'post-receive' hook is empty, but there is
187191
a sample script `post-receive-email` provided in the `contrib/hooks`
@@ -205,12 +209,10 @@ the outcome of `git-receive-pack`.
205209

206210
The 'post-update' hook can tell what are the heads that were pushed,
207211
but it does not know what their original and updated values are,
208-
so it is a poor place to do log old..new.
209-
210-
In general, `post-receive` hook is preferred when the hook needs
211-
to decide its acion on the status of the entire set of refs
212-
being updated, as this hook is called once per ref, with
213-
information only on a single ref at a time.
212+
so it is a poor place to do log old..new. The
213+
<<post-receive,'post-receive'>> hook does get both original and
214+
updated values of the refs. You might consider it instead if you need
215+
them.
214216

215217
When enabled, the default 'post-update' hook runs
216218
`git-update-server-info` to keep the information used by dumb
@@ -219,4 +221,5 @@ a git repository that is accessible via HTTP, you should
219221
probably enable this hook.
220222

221223
Both standard output and standard error output are forwarded to
222-
`git-send-pack` on the other end.
224+
`git-send-pack` on the other end, so you can simply `echo` messages
225+
for the user.

0 commit comments

Comments
 (0)