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
15. ../lib-httpd.sh
16
17if ! start_httpd >&3 2>&4
18then
19 say "skipping test, web server setup failed"
20 test_done
21 exit
22fi
23
24test_expect_success 'setup remote repository' '
25 cd "$ROOT_PATH" &&
26 mkdir test_repo &&
27 cd test_repo &&
28 git init &&
29 : >path1 &&
30 git add path1 &&
31 test_tick &&
32 git commit -m initial &&
33 cd - &&
34 git clone --bare test_repo test_repo.git &&
35 cd test_repo.git &&
36 git --bare update-server-info &&
37 chmod +x hooks/post-update &&
38 cd - &&
39 mv test_repo.git "$HTTPD_DOCUMENT_ROOT_PATH"
40'
41
42test_expect_success 'clone remote repository' '
43 cd "$ROOT_PATH" &&
44 git clone $HTTPD_URL/test_repo.git test_repo_clone
45'
46
47test_expect_failure 'push to remote repository' '
48 cd "$ROOT_PATH"/test_repo_clone &&
49 : >path2 &&
50 git add path2 &&
51 test_tick &&
52 git commit -m path2 &&
53 git push &&
54 [ -f "$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git/refs/heads/master" ]
55'
56
57test_expect_failure 'create and delete remote branch' '
58 cd "$ROOT_PATH"/test_repo_clone &&
59 git checkout -b dev &&
60 : >path3 &&
61 git add path3 &&
62 test_tick &&
63 git commit -m dev &&
64 git push origin dev &&
65 git fetch &&
66 git push origin :dev &&
67 git branch -d -r origin/dev &&
68 git fetch &&
69 ! git show-ref --verify refs/remotes/origin/dev
70'
71
72stop_httpd
73
74test_done