aboutsummaryrefslogtreecommitdiff
path: root/Documentation/git-receive-pack.txt
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-08-02 14:24:22 -0700
committerJunio C Hamano <junkio@cox.net>2005-08-02 22:51:09 -0700
commit19614330ddaf02367a7faf2ff5e09f1f39fd63c4 (patch)
tree363ef273adc90690bad1f4665f5246a87faabc33 /Documentation/git-receive-pack.txt
parent0bc3cdfc823e48069b778468196d8f5185a452cb (diff)
downloadgit-19614330ddaf02367a7faf2ff5e09f1f39fd63c4.tar.gz
git-19614330ddaf02367a7faf2ff5e09f1f39fd63c4.tar.xz
receive-pack hooks updates.
The earlier one conflated update and post-update hooks for no good reason. Correct that ugly hack. Now post-update hooks will take the list of successfully updated refs. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'Documentation/git-receive-pack.txt')
-rw-r--r--Documentation/git-receive-pack.txt40
1 files changed, 20 insertions, 20 deletions
diff --git a/Documentation/git-receive-pack.txt b/Documentation/git-receive-pack.txt
index 7f95e4404..2f1a1f8eb 100644
--- a/Documentation/git-receive-pack.txt
+++ b/Documentation/git-receive-pack.txt
@@ -43,35 +43,35 @@ The hook should exit with non-zero status if it wants to
disallow updating the named ref. Otherwise it should exit with
zero.
-The same hook is also called with an empty string as refname and
-no other arguments just before git-receive-pack exits. This can
-be used to implement repository wide cleanup task if needed.
-The exit code from this hook invocation is ignored; the only
-thing left for git-receive-pack to do at that point is to exit
-itself anyway.
-
Using this hook, it is easy to generate mails on updates to
the local repository. This example script sends a mail with
the commits pushed to the repository:
#!/bin/sh
- case "$#,$1" in
- 1,) # help packed repository pulled via dumb protocol.
- git-update-server-info
- ;;
- *) # mail out commit update information.
- if expr "$2" : '0*$' >/dev/null
- then
- echo "Created now ref."
+ # mail out commit update information.
+ if expr "$2" : '0*$' >/dev/null
+ then
+ echo "Created a new ref, with the following commits:"
git-rev-list --pretty "$2"
- else
- echo "New commits"
+ else
+ echo "New commits:"
git-rev-list --pretty "$3" "^$2"
- fi |
- mail -s "Changes to ref $1" commit-list@mydomain
- esac
+ fi |
+ mail -s "Changes to ref $1" commit-list@mydomain
exit 0
+Another hook $GIT_DIR/hooks/post-update, if exists and
+executable, is called with the list of refs that have been
+updated. This can be used to implement repository wide cleanup
+task if needed. The exit code from this hook invocation is
+ignored; the only thing left for git-receive-pack to do at that
+point is to exit itself anyway. This hook can be used, for
+example, to run "git-update-server-info" if the repository is
+packed and is served via a dumb transport.
+
+ #!/bin/sh
+ exec git-update-server-info
+
OPTIONS
-------
<directory>::