aboutsummaryrefslogtreecommitdiff
path: root/t/t5551-http-fetch.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-11-29 23:11:22 -0800
committerJunio C Hamano <gitster@pobox.com>2009-11-29 23:11:22 -0800
commit44148f2daf6e1ac3fe087dd07da2930411b3bcf2 (patch)
treedd8fa69cd7023f8cb1f4fd517701272fcb6e4f94 /t/t5551-http-fetch.sh
parented87465658c83a5a1617920e7b605bd830a78aed (diff)
parent66abce05dd5b9da9c889034781dc3de38b6e231b (diff)
downloadgit-44148f2daf6e1ac3fe087dd07da2930411b3bcf2.tar.gz
git-44148f2daf6e1ac3fe087dd07da2930411b3bcf2.tar.xz
Merge remote branch 'ko/master' into HEAD
* ko/master: (366 commits) Update draft release notes to 1.6.6 before merging topics for -rc1 Makefile: do not clean arm directory Add a notice that only certain functions can print color escape codes builtin-apply.c: pay attention to -p<n> when determining the name gitworkflows: Consistently back-quote git commands Explicitly truncate bswap operand to uint32_t t1200: fix a timing dependent error Documentation: update descriptions of revision options related to '--bisect' Enable support for IPv6 on MinGW Refactor winsock initialization into a separate function t/gitweb-lib: Split HTTP response with non-GNU sed pack-objects: split implications of --all-progress from progress activation instaweb: restart server if already running prune-packed: only show progress when stderr is a tty remote-curl.c: fix rpc_out() Protect scripted Porcelains from GREP_OPTIONS insanity mergetool--lib: simplify guess_merge_tool() strbuf_add_wrapped_text(): skip over colour codes t4014-format-patch: do not assume 'test' is available as non-builtin Fix over-simplified documentation for 'git log -z' ...
Diffstat (limited to 't/t5551-http-fetch.sh')
-rwxr-xr-xt/t5551-http-fetch.sh105
1 files changed, 105 insertions, 0 deletions
diff --git a/t/t5551-http-fetch.sh b/t/t5551-http-fetch.sh
new file mode 100755
index 000000000..c0505ecd7
--- /dev/null
+++ b/t/t5551-http-fetch.sh
@@ -0,0 +1,105 @@
+#!/bin/sh
+
+test_description='test smart fetching over http via http-backend'
+. ./test-lib.sh
+
+if test -n "$NO_CURL"; then
+ say 'skipping test, git built without http support'
+ test_done
+fi
+
+LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5551'}
+. "$TEST_DIRECTORY"/lib-httpd.sh
+start_httpd
+
+test_expect_success 'setup repository' '
+ echo content >file &&
+ git add file &&
+ git commit -m one
+'
+
+test_expect_success 'create http-accessible bare repository' '
+ mkdir "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
+ (cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
+ git --bare init
+ ) &&
+ git remote add public "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
+ git push public master:master
+'
+
+cat >exp <<EOF
+> GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1
+> Accept: */*
+> Pragma: no-cache
+< HTTP/1.1 200 OK
+< Pragma: no-cache
+< Cache-Control: no-cache, max-age=0, must-revalidate
+< Content-Type: application/x-git-upload-pack-advertisement
+> POST /smart/repo.git/git-upload-pack HTTP/1.1
+> Accept-Encoding: deflate, gzip
+> Content-Type: application/x-git-upload-pack-request
+> Accept: application/x-git-upload-pack-response
+> Content-Length: xxx
+< HTTP/1.1 200 OK
+< Pragma: no-cache
+< Cache-Control: no-cache, max-age=0, must-revalidate
+< Content-Type: application/x-git-upload-pack-result
+EOF
+test_expect_success 'clone http repository' '
+ GIT_CURL_VERBOSE=1 git clone --quiet $HTTPD_URL/smart/repo.git clone 2>err &&
+ test_cmp file clone/file &&
+ tr '\''\015'\'' Q <err |
+ sed -e "
+ s/Q\$//
+ /^[*] /d
+ /^$/d
+ /^< $/d
+
+ /^[^><]/{
+ s/^/> /
+ }
+
+ /^> User-Agent: /d
+ /^> Host: /d
+ /^> POST /,$ {
+ /^> Accept: [*]\\/[*]/d
+ }
+ s/^> Content-Length: .*/> Content-Length: xxx/
+ /^> 00..want /d
+ /^> 00.*done/d
+
+ /^< Server: /d
+ /^< Expires: /d
+ /^< Date: /d
+ /^< Content-Length: /d
+ /^< Transfer-Encoding: /d
+ " >act &&
+ test_cmp exp act
+'
+
+test_expect_success 'fetch changes via http' '
+ echo content >>file &&
+ git commit -a -m two &&
+ git push public
+ (cd clone && git pull) &&
+ test_cmp file clone/file
+'
+
+cat >exp <<EOF
+GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
+POST /smart/repo.git/git-upload-pack HTTP/1.1 200
+GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
+POST /smart/repo.git/git-upload-pack HTTP/1.1 200
+EOF
+test_expect_success 'used upload-pack service' '
+ sed -e "
+ s/^.* \"//
+ s/\"//
+ s/ [1-9][0-9]*\$//
+ s/^GET /GET /
+ " >act <"$HTTPD_ROOT_PATH"/access.log &&
+ test_cmp exp act
+'
+
+stop_httpd
+test_done