2005-07-14 11:10:05 +04:00
|
|
|
git-receive-pack(1)
|
|
|
|
===================
|
|
|
|
|
|
|
|
NAME
|
|
|
|
----
|
|
|
|
git-receive-pack - Receive what is pushed into it
|
|
|
|
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
--------
|
|
|
|
'git-receive-pack' <directory>
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
|
|
|
Invoked by 'git-send-pack' and updates the repository with the
|
|
|
|
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
|
2006-06-21 10:54:26 +04:00
|
|
|
repository. For pull operations, see 'git-fetch-pack'.
|
2005-07-14 11:10:05 +04:00
|
|
|
|
2005-07-31 23:17:43 +04:00
|
|
|
The command allows for creation and fast forwarding of sha1 refs
|
|
|
|
(heads/tags) on the remote end (strictly speaking, it is the
|
|
|
|
local end receive-pack runs, but to the user who is sitting at
|
|
|
|
the send-pack end, it is updating the remote. Confused?)
|
|
|
|
|
|
|
|
Before each ref is updated, if $GIT_DIR/hooks/update file exists
|
|
|
|
and executable, it is called with three parameters:
|
|
|
|
|
|
|
|
$GIT_DIR/hooks/update refname sha1-old sha1-new
|
|
|
|
|
|
|
|
The refname parameter is relative to $GIT_DIR; e.g. for the
|
|
|
|
master head this is "refs/heads/master". Two sha1 are the
|
|
|
|
object names for the refname before and after the update. Note
|
|
|
|
that the hook is called before the refname is updated, so either
|
|
|
|
sha1-old is 0{40} (meaning there is no such ref yet), or it
|
|
|
|
should match what is recorded in refname.
|
|
|
|
|
|
|
|
The hook should exit with non-zero status if it wants to
|
|
|
|
disallow updating the named ref. Otherwise it should exit with
|
|
|
|
zero.
|
|
|
|
|
|
|
|
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
|
2005-08-03 01:24:22 +04:00
|
|
|
# mail out commit update information.
|
|
|
|
if expr "$2" : '0*$' >/dev/null
|
|
|
|
then
|
|
|
|
echo "Created a new ref, with the following commits:"
|
2005-07-31 23:17:43 +04:00
|
|
|
git-rev-list --pretty "$2"
|
2005-08-03 01:24:22 +04:00
|
|
|
else
|
|
|
|
echo "New commits:"
|
2005-07-31 23:17:43 +04:00
|
|
|
git-rev-list --pretty "$3" "^$2"
|
2005-08-03 01:24:22 +04:00
|
|
|
fi |
|
|
|
|
mail -s "Changes to ref $1" commit-list@mydomain
|
2005-07-31 23:17:43 +04:00
|
|
|
exit 0
|
2005-07-14 11:10:05 +04:00
|
|
|
|
2005-08-03 01:24:22 +04:00
|
|
|
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
|
|
|
|
|
2005-12-05 11:32:01 +03:00
|
|
|
There are other real-world examples of using update and
|
|
|
|
post-update hooks found in the Documentation/howto directory.
|
|
|
|
|
2006-09-21 04:10:30 +04:00
|
|
|
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.
|
2005-12-05 11:32:01 +03:00
|
|
|
|
2005-07-14 11:10:05 +04:00
|
|
|
OPTIONS
|
|
|
|
-------
|
|
|
|
<directory>::
|
|
|
|
The repository to sync into.
|
|
|
|
|
2005-09-03 08:19:26 +04:00
|
|
|
|
|
|
|
SEE ALSO
|
|
|
|
--------
|
2005-09-19 14:10:51 +04:00
|
|
|
gitlink:git-send-pack[1]
|
2005-09-03 08:19:26 +04:00
|
|
|
|
|
|
|
|
2005-07-14 11:10:05 +04:00
|
|
|
Author
|
|
|
|
------
|
|
|
|
Written by Linus Torvalds <torvalds@osdl.org>
|
|
|
|
|
|
|
|
Documentation
|
|
|
|
--------------
|
|
|
|
Documentation by Junio C Hamano.
|
|
|
|
|
|
|
|
GIT
|
|
|
|
---
|
2005-09-19 14:10:51 +04:00
|
|
|
Part of the gitlink:git[7] suite
|