stash: teach 'push' (and 'create_stash') to honor pathspec
[git.git] / t / t5561-http-backend.sh
blob90e0d6f0fe935970c0941bfef2af39bb15d2f959
1 #!/bin/sh
3 test_description='test git-http-backend'
4 . ./test-lib.sh
5 . "$TEST_DIRECTORY"/lib-httpd.sh
6 start_httpd
8 GET() {
9 curl --include "$HTTPD_URL/$SMART/repo.git/$1" >out 2>/dev/null &&
10 tr '\015' Q <out |
11 sed '
12 s/Q$//
14 ' >act &&
15 echo "HTTP/1.1 $2" >exp &&
16 test_cmp exp act
19 POST() {
20 curl --include --data "$2" \
21 --header "Content-Type: application/x-$1-request" \
22 "$HTTPD_URL/smart/repo.git/$1" >out 2>/dev/null &&
23 tr '\015' Q <out |
24 sed '
25 s/Q$//
27 ' >act &&
28 echo "HTTP/1.1 $3" >exp &&
29 test_cmp exp act
32 . "$TEST_DIRECTORY"/t556x_common
34 grep '^[^#]' >exp <<EOF
36 ### refs/heads/master
37 ###
38 GET /smart/repo.git/refs/heads/master HTTP/1.1 404 -
40 ### getanyfile default
41 ###
42 GET /smart/repo.git/HEAD HTTP/1.1 200
43 GET /smart/repo.git/info/refs HTTP/1.1 200
44 GET /smart/repo.git/objects/info/packs HTTP/1.1 200
45 GET /smart/repo.git/objects/info/alternates HTTP/1.1 200 -
46 GET /smart/repo.git/objects/info/http-alternates HTTP/1.1 200 -
47 GET /smart/repo.git/$LOOSE_URL HTTP/1.1 200
48 GET /smart/repo.git/$PACK_URL HTTP/1.1 200
49 GET /smart/repo.git/$IDX_URL HTTP/1.1 200
51 ### no git-daemon-export-ok
52 ###
53 GET /smart_noexport/repo.git/HEAD HTTP/1.1 404 -
54 GET /smart_noexport/repo.git/info/refs HTTP/1.1 404 -
55 GET /smart_noexport/repo.git/objects/info/packs HTTP/1.1 404 -
56 GET /smart_noexport/repo.git/objects/info/alternates HTTP/1.1 404 -
57 GET /smart_noexport/repo.git/objects/info/http-alternates HTTP/1.1 404 -
58 GET /smart_noexport/repo.git/$LOOSE_URL HTTP/1.1 404 -
59 GET /smart_noexport/repo.git/$PACK_URL HTTP/1.1 404 -
60 GET /smart_noexport/repo.git/$IDX_URL HTTP/1.1 404 -
62 ### git-daemon-export-ok
63 ###
64 GET /smart_noexport/repo.git/HEAD HTTP/1.1 200
65 GET /smart_noexport/repo.git/info/refs HTTP/1.1 200
66 GET /smart_noexport/repo.git/objects/info/packs HTTP/1.1 200
67 GET /smart_noexport/repo.git/objects/info/alternates HTTP/1.1 200 -
68 GET /smart_noexport/repo.git/objects/info/http-alternates HTTP/1.1 200 -
69 GET /smart_noexport/repo.git/$LOOSE_URL HTTP/1.1 200
70 GET /smart_noexport/repo.git/$PACK_URL HTTP/1.1 200
71 GET /smart_noexport/repo.git/$IDX_URL HTTP/1.1 200
73 ### getanyfile true
74 ###
75 GET /smart/repo.git/HEAD HTTP/1.1 200
76 GET /smart/repo.git/info/refs HTTP/1.1 200
77 GET /smart/repo.git/objects/info/packs HTTP/1.1 200
78 GET /smart/repo.git/objects/info/alternates HTTP/1.1 200 -
79 GET /smart/repo.git/objects/info/http-alternates HTTP/1.1 200 -
80 GET /smart/repo.git/$LOOSE_URL HTTP/1.1 200
81 GET /smart/repo.git/$PACK_URL HTTP/1.1 200
82 GET /smart/repo.git/$IDX_URL HTTP/1.1 200
84 ### getanyfile false
85 ###
86 GET /smart/repo.git/HEAD HTTP/1.1 403 -
87 GET /smart/repo.git/info/refs HTTP/1.1 403 -
88 GET /smart/repo.git/objects/info/packs HTTP/1.1 403 -
89 GET /smart/repo.git/objects/info/alternates HTTP/1.1 403 -
90 GET /smart/repo.git/objects/info/http-alternates HTTP/1.1 403 -
91 GET /smart/repo.git/$LOOSE_URL HTTP/1.1 403 -
92 GET /smart/repo.git/$PACK_URL HTTP/1.1 403 -
93 GET /smart/repo.git/$IDX_URL HTTP/1.1 403 -
95 ### uploadpack default
96 ###
97 GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
98 POST /smart/repo.git/git-upload-pack HTTP/1.1 200 -
100 ### uploadpack true
102 GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
103 POST /smart/repo.git/git-upload-pack HTTP/1.1 200 -
105 ### uploadpack false
107 GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 403 -
108 POST /smart/repo.git/git-upload-pack HTTP/1.1 403 -
110 ### receivepack default
112 GET /smart/repo.git/info/refs?service=git-receive-pack HTTP/1.1 403 -
113 POST /smart/repo.git/git-receive-pack HTTP/1.1 403 -
115 ### receivepack true
117 GET /smart/repo.git/info/refs?service=git-receive-pack HTTP/1.1 200
118 POST /smart/repo.git/git-receive-pack HTTP/1.1 200 -
120 ### receivepack false
122 GET /smart/repo.git/info/refs?service=git-receive-pack HTTP/1.1 403 -
123 POST /smart/repo.git/git-receive-pack HTTP/1.1 403 -
125 test_expect_success 'server request log matches test results' '
126 sed -e "
127 s/^.* \"//
128 s/\"//
129 s/ [1-9][0-9]*\$//
130 s/^GET /GET /
131 " >act <"$HTTPD_ROOT_PATH"/access.log &&
132 test_cmp exp act
135 stop_httpd
136 test_done