Add support for pushing to a remote repository using HTTP/DAV
Subsystems (2)
PATCH 1/2 Add support for pushing to a remote repository using HTTP/DAV
Add support for pushing to a remote repository using HTTP/DAV
---
There is still some cleanup to be done here, but it is usable.
To enable support in Apache, load the dav and dav_fs modules, set DAVLockDB and add "Dav on" to the GIT directory. The Apache user will need write permissions in the GIT repository - at least to the refs and objects directory - so it is probably a good idea to turn on mod_ssl and the appropriate mod_auth_* module as well.
By default, the push will trust that if a remote has an object, it also has that object's full history. This behavior can be changed using the --complete arg, but it may be appropriate to either never trust the remote or to change the default behavior.
The push currently sends everything as loose objects, even if they are stored in a pack in the local repository. It may make sense to pack all the necessary objects prior to sending, although there doesn't seem to be a way to resume a PUT so a failed transfer could prove much more annoying.
There is an advantage to keeping objects packed on the remote end, as the remote's pack indexes will be fetched and stored locally and objects stored in a remote pack will not require a separate HEAD request to check whether they exist in the remote repository.
Documentation/git-http-push.txt | 89 ++ Makefile | 13 http-push.c | 1625 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 1725 insertions(+), 2 deletions(-) create mode 100644 Documentation/git-http-push.txt create mode 100644 http-push.c
applies-to: b774cd64105bda561bba3c528a7fea19b87755a1 cb4a5d4a797002739ece1ed67204520749324e2d
Documentation/git-http-push.txt new file +89 -0
@@ -0,0 +1,89 @@ +git-http-push(1) +================ + +NAME +---- +git-http-push - Push missing objects using HTTP/DAV. + + +SYNOPSIS +-------- +'git-http-push' [--complete] [--force] [--verbose] <url> <ref> [<ref>...] + +DESCRIPTION +----------- +Sends missing objects to remote repository, and updates the +remote branch. + + +OPTIONS +------- +--complete:: + Do not assume that the remote repository is complete in its + current state, and verify all objects in the entire local + ref's history exist in the remote repository. + +--force:: + Usually, the command refuses to update a remote ref that + is not an ancestor of the local ref used to overwrite it. + This flag disables the check. What this means is that + the remote repository can lose commits; use it with + care. + +--verbose:: + Report the list of objects being walked locally and the + list of objects successfully sent to the remote repository. + +<ref>...: + The remote refs to update. + + +Specifying the Refs +------------------- + +A '<ref>' specification can be either a single pattern, or a pair +of such patterns separated by a colon ":" (this means that a ref name +cannot have a colon in it). A single pattern '<name>' is just a +shorthand for '<name>:<name>'. + +Each pattern pair consists of the source side (before the colon) +and the destination side (after the colon). The ref to be +pushed is determined by finding a match that matches the source +side, and where it is pushed is determined by using the +destination side. + + - It is an error if <src> does not match exactly one of the + local refs. + + - If <dst> does not match any remote ref, either + + * it has to start with "refs/"; <dst> is used as the + destination literally in this case. + + * <src> == <dst> and the ref that matched the <src> must not + exist in the set of remote refs; the ref matched <src> + locally is used as the name of the destination. + +Without '--force', the <src> ref is stored at the remote only if +<dst> does not exist, or <dst> is a proper subset (i.e. an +ancestor) of <src>. This check, known as "fast forward check", +is performed in order to avoid accidentally overwriting the +remote ref and lose other peoples' commits from there. + +With '--force', the fast forward check is disabled for all refs. + +Optionally, a <ref> parameter can be prefixed with a plus '+' sign +to disable the fast-forward check only on that ref. + + +Author +------ +Written by Nick Hengeveld <[email protected]> + +Documentation +-------------- +Documentation by Nick Hengeveld + +GIT +--- +Part of the gitlink:git[7] suite
Makefile +11 -2
@@ -6,12 +6,16 @@ # Define NO_OPENSSL environment variable if you do not have OpenSSL. You will # miss out git-rev-list --merge-order. This also implies MOZILLA_SHA1. # -# Define NO_CURL if you do not have curl installed. git-http-pull is not -# built, and you cannot use http:// and https:// transports. +# Define NO_CURL if you do not have curl installed. git-http-pull and +# git-http-push are not built, and you cannot use http:// and https:// +# transports. # # Define CURLDIR=/foo/bar if your curl header and library files are in # /foo/bar/include and /foo/bar/lib directories. # +# Define NO_EXPAT if you do not have expat installed. git-http-push is +# not built, and you cannot push using http:// and https:// transports. +# # Define NO_STRCASESTR if you don't have strcasestr. # # Define PPC_SHA1 environment variable when running make to make use of
@@ -223,6 +227,10 @@ ifndef NO_CURL CURL_LIBCURL = -lcurl endif PROGRAMS += git-http-fetch$X + ifndef NO_EXPAT + EXPAT_LIBEXPAT = -lexpat + PROGRAMS += git-http-push$X + endif endif ifndef SHELL_PATH
@@ -375,6 +383,7 @@ git-ssh-pull$X: rsh.o fetch.o git-ssh-push$X: rsh.o git-http-fetch$X: LIBS += $(CURL_LIBCURL) +git-http-push$X: LIBS += $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) git-rev-list$X: LIBS += $(OPENSSL_LIBSSL) init-db.o: init-db.c
http-push.c new file +1625 -0
1,625 lines not on this page · raw message
---
0.99.9.GIT
Hi,
Quoted 1 line · Nick Hengeveld
Add support for pushing to a remote repository using HTTP/DAV
Great! I will try to test it in the next few days.
Ciao,
Dscho