Code

Merge git://git.kernel.org/pub/scm/gitk/gitk
[git.git] / Documentation / git-receive-pack.txt
index 7f95e44046ce2a28053bdddaec8d730257c873a0..0dfadc2a32a44ef1e026ae95c8cc5906ec4d4d5c 100644 (file)
@@ -1,6 +1,5 @@
 git-receive-pack(1)
 ===================
 git-receive-pack(1)
 ===================
-v0.1, July 2005
 
 NAME
 ----
 
 NAME
 ----
@@ -19,8 +18,7 @@ information fed from the remote end.
 This command is usually not invoked directly by the end user.
 The UI for the protocol is on the 'git-send-pack' side, and the
 program pair is meant to be used to push updates to remote
 This command is usually not invoked directly by the end user.
 The UI for the protocol is on the 'git-send-pack' side, and the
 program pair is meant to be used to push updates to remote
-repository.  For pull operations, see 'git-fetch-pack' and
-'git-clone-pack'.
+repository.  For pull operations, see 'git-fetch-pack'.
 
 The command allows for creation and fast forwarding of sha1 refs
 (heads/tags) on the remote end (strictly speaking, it is the
 
 The command allows for creation and fast forwarding of sha1 refs
 (heads/tags) on the remote end (strictly speaking, it is the
@@ -43,40 +41,52 @@ The hook should exit with non-zero status if it wants to
 disallow updating the named ref.  Otherwise it should exit with
 zero.
 
 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
 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"
                git-rev-list --pretty "$2"
-           else
-               echo "New commits"
+       else
+               echo "New commits:"
                git-rev-list --pretty "$3" "^$2"
                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
 
        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
+
+There are other real-world examples of using update and
+post-update hooks found in the Documentation/howto directory.
+
+git-receive-pack honours the receive.denyNonFastforwards flag, which
+tells it if updates to a ref should be denied if they are not fast-forwards.
+
 OPTIONS
 -------
 <directory>::
        The repository to sync into.
 
 OPTIONS
 -------
 <directory>::
        The repository to sync into.
 
+
+SEE ALSO
+--------
+gitlink:git-send-pack[1]
+
+
 Author
 ------
 Written by Linus Torvalds <torvalds@osdl.org>
 Author
 ------
 Written by Linus Torvalds <torvalds@osdl.org>
@@ -87,4 +97,4 @@ Documentation by Junio C Hamano.
 
 GIT
 ---
 
 GIT
 ---
-Part of the link:git.html[git] suite
+Part of the gitlink:git[7] suite