3 # Copyright (c) 2008 Clemens Buchacher <drizzd@aon.at>
6 test_description
='test http-push
8 This test runs various sanity checks on http-push.'
15 if git http-push
> /dev
/null
2>&1 ||
[ $?
-eq 128 ]
17 say
"skipping test, USE_CURL_MULTI is not defined"
22 .
"$TEST_DIRECTORY"/lib-httpd.sh
25 test_expect_success
'setup remote repository' '
33 git commit -m initial &&
35 git clone --bare test_repo test_repo.git &&
37 git --bare update-server-info &&
38 mv hooks/post-update.sample hooks/post-update &&
40 mv test_repo.git "$HTTPD_DOCUMENT_ROOT_PATH"
43 test_expect_success
'clone remote repository' '
45 git clone $HTTPD_URL/test_repo.git test_repo_clone
48 test_expect_failure
'push to remote repository with packed refs' '
49 cd "$ROOT_PATH"/test_repo_clone &&
53 git commit -m path2 &&
54 HEAD=$(git rev-parse --verify HEAD) &&
56 (cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&
57 test $HEAD = $(git rev-parse --verify HEAD))
60 test_expect_success
' push to remote repository with unpacked refs' '
61 (cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&
63 git update-ref refs/heads/master \
64 0c973ae9bd51902a28466f3850b543fa66a6aaf4) &&
66 (cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&
67 test $HEAD = $(git rev-parse --verify HEAD))
70 test_expect_success
'create and delete remote branch' '
71 cd "$ROOT_PATH"/test_repo_clone &&
72 git checkout -b dev &&
77 git push origin dev &&
79 git push origin :dev &&
80 git branch -d -r origin/dev &&
82 test_must_fail git show-ref --verify refs/remotes/origin/dev
85 test_expect_success
'MKCOL sends directory names with trailing slashes' '
87 ! grep "\"MKCOL.*[^/] HTTP/[^ ]*\"" < "$HTTPD_ROOT_PATH"/access.log
91 test_expect_success
'PUT and MOVE sends object to URLs with SHA-1 hash suffix' '
93 grep -P "\"(?:PUT|MOVE) .+objects/[\da-z]{2}/[\da-z]{38}_[\da-z\-]{40} HTTP/[0-9.]+\" 20\d" \
94 < "$HTTPD_ROOT_PATH"/access.log