]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5540-http-push.sh
t/test-lib.sh: exit with small negagive int is ok with test_must_fail
[thirdparty/git.git] / t / t5540-http-push.sh
CommitLineData
faa4bc35
CB
1#!/bin/sh
2#
3# Copyright (c) 2008 Clemens Buchacher <drizzd@aon.at>
4#
5
6test_description='test http-push
7
8This test runs various sanity checks on http-push.'
9
10. ./test-lib.sh
11
12ROOT_PATH="$PWD"
13LIB_HTTPD_DAV=t
14
96086262
MH
15if git http-push > /dev/null 2>&1 || [ $? -eq 128 ]
16then
17 say "skipping test, USE_CURL_MULTI is not defined"
18 test_done
19 exit
20fi
21
faa4bc35
CB
22. ../lib-httpd.sh
23
24if ! start_httpd >&3 2>&4
25then
26 say "skipping test, web server setup failed"
27 test_done
28 exit
29fi
30
31test_expect_success 'setup remote repository' '
32 cd "$ROOT_PATH" &&
33 mkdir test_repo &&
34 cd test_repo &&
35 git init &&
36 : >path1 &&
37 git add path1 &&
38 test_tick &&
39 git commit -m initial &&
40 cd - &&
41 git clone --bare test_repo test_repo.git &&
42 cd test_repo.git &&
43 git --bare update-server-info &&
44 chmod +x hooks/post-update &&
45 cd - &&
13b5481e 46 mv test_repo.git "$HTTPD_DOCUMENT_ROOT_PATH"
faa4bc35 47'
3b2eb186 48
faa4bc35
CB
49test_expect_success 'clone remote repository' '
50 cd "$ROOT_PATH" &&
51 git clone $HTTPD_URL/test_repo.git test_repo_clone
52'
53
b5cd2d1e 54test_expect_failure 'push to remote repository' '
faa4bc35
CB
55 cd "$ROOT_PATH"/test_repo_clone &&
56 : >path2 &&
57 git add path2 &&
58 test_tick &&
59 git commit -m path2 &&
b5cd2d1e
MH
60 git push &&
61 [ -f "$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git/refs/heads/master" ]
faa4bc35
CB
62'
63
b5cd2d1e 64test_expect_failure 'create and delete remote branch' '
faa4bc35
CB
65 cd "$ROOT_PATH"/test_repo_clone &&
66 git checkout -b dev &&
67 : >path3 &&
68 git add path3 &&
69 test_tick &&
70 git commit -m dev &&
71 git push origin dev &&
72 git fetch &&
73 git push origin :dev &&
74 git branch -d -r origin/dev &&
75 git fetch &&
76 ! git show-ref --verify refs/remotes/origin/dev
77'
78
79stop_httpd
80
81test_done