path: root/fast-import.c
diff options
authorShawn O. Pearce <>2007-03-07 21:52:05 (GMT)
committerJunio C Hamano <>2007-03-07 23:03:33 (GMT)
commit05ef58ec1f2fb69d6e7ae7fca84163f75bd95050 (patch)
tree82e444216aef4ce945e8b5d6dac4b5adfedb4f39 /fast-import.c
parent8aaf7d6410119ee221f5d3ebdc4fc5a57f862665 (diff)
Teach receive-pack to run pre-receive/post-receive hooks
Bill Lear pointed out that it is easy to send out notifications of changes with the update hook, but successful execution of the update hook does not necessarily mean that the ref was actually updated. Lock contention on the ref or being unable to append to the reflog may prevent the ref from being changed. Sending out notifications prior to the ref actually changing is very misleading. To help this situation I am introducing two new hooks to the receive-pack flow: pre-receive and post-receive. These new hooks are invoked only once per receive-pack execution and are passed three arguments per ref (refname, old-sha1, new-sha1). The new post-receive hook is ideal for sending out notifications, as it has the complete list of all refnames that were successfully updated as well as the old and new SHA-1 values. This allows more interesting notifications to be sent. Multiple ref updates could be easily summarized into one email, for example. The new pre-receive hook is ideal for logging update attempts, as it is run only once for the entire receive-pack operation. It can also be used to verify multiple updates happen at once, e.g. an update to the `maint` head must also be accompained by a new annotated tag. Lots of documentation improvements for receive-pack are included in this change, as we want to make sure the new hooks are clearly explained. Signed-off-by: Shawn O. Pearce <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'fast-import.c')
0 files changed, 0 insertions, 0 deletions