diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2007-03-07 16:52:05 -0500 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-03-07 15:03:33 -0800 |
commit | 05ef58ec1f2fb69d6e7ae7fca84163f75bd95050 (patch) | |
tree | 82e444216aef4ce945e8b5d6dac4b5adfedb4f39 /t/t4013/diff.diff-tree_--pretty_--root_--stat_initial | |
parent | Refactor handling of error_string in receive-pack (diff) | |
download | tgif-05ef58ec1f2fb69d6e7ae7fca84163f75bd95050.tar.xz |
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 <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 't/t4013/diff.diff-tree_--pretty_--root_--stat_initial')
0 files changed, 0 insertions, 0 deletions