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.'
14 LIB_HTTPD_PORT
=${LIB_HTTPD_PORT-'5540'}
16 if git http-push
> /dev
/null
2>&1 ||
[ $?
-eq 128 ]
18 say
"skipping test, USE_CURL_MULTI is not defined"
23 .
"$TEST_DIRECTORY"/lib-httpd.sh
26 test_expect_success
'setup remote repository' '
34 git commit -m initial &&
36 git clone --bare test_repo test_repo.git &&
38 git --bare update-server-info &&
39 mv hooks/post-update.sample hooks/post-update &&
41 mv test_repo.git "$HTTPD_DOCUMENT_ROOT_PATH"
44 test_expect_success
'clone remote repository' '
46 git clone $HTTPD_URL/test_repo.git test_repo_clone
49 test_expect_failure
'push to remote repository with packed refs' '
50 cd "$ROOT_PATH"/test_repo_clone &&
54 git commit -m path2 &&
55 HEAD=$(git rev-parse --verify HEAD) &&
57 (cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&
58 test $HEAD = $(git rev-parse --verify HEAD))
61 test_expect_success
' push to remote repository with unpacked refs' '
62 (cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&
64 git update-ref refs/heads/master \
65 0c973ae9bd51902a28466f3850b543fa66a6aaf4) &&
67 (cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&
68 test $HEAD = $(git rev-parse --verify HEAD))
71 test_expect_success
'create and delete remote branch' '
72 cd "$ROOT_PATH"/test_repo_clone &&
73 git checkout -b dev &&
78 git push origin dev &&
80 git push origin :dev &&
81 git branch -d -r origin/dev &&
83 test_must_fail git show-ref --verify refs/remotes/origin/dev
86 test_expect_success
'MKCOL sends directory names with trailing slashes' '
88 ! grep "\"MKCOL.*[^/] HTTP/[^ ]*\"" < "$HTTPD_ROOT_PATH"/access.log
95 x38
="$x5$x5$x5$x5$x5$x5$x5$x1$x1$x1"
98 test_expect_success
'PUT and MOVE sends object to URLs with SHA-1 hash suffix' '
99 sed -e "s/PUT /OP /" -e "s/MOVE /OP /" "$HTTPD_ROOT_PATH"/access.log |
100 grep -e "\"OP .*/objects/$x2/${x38}_$x40 HTTP/[.0-9]*\" 20[0-9] "