Skip to content

Commit 92b7fd8

Browse files
tgummerergitster
authored andcommitted
t5551: move setup code inside test_expect blocks
Move setup code inside test_expect blocks, to catch unexpected failures in the setup steps, and bring the test scripts in line with our modern test style. Suggested-by: Jonathan Nieder <[email protected]> Signed-off-by: Thomas Gummerer <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1d4361b commit 92b7fd8

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

t/t5551-http-fetch-smart.sh

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,26 @@ test_expect_success 'create http-accessible bare repository' '
2323

2424
setup_askpass_helper
2525

26-
cat >exp <<EOF
27-
> GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1
28-
> Accept: */*
29-
> Accept-Encoding: ENCODINGS
30-
> Pragma: no-cache
31-
< HTTP/1.1 200 OK
32-
< Pragma: no-cache
33-
< Cache-Control: no-cache, max-age=0, must-revalidate
34-
< Content-Type: application/x-git-upload-pack-advertisement
35-
> POST /smart/repo.git/git-upload-pack HTTP/1.1
36-
> Accept-Encoding: ENCODINGS
37-
> Content-Type: application/x-git-upload-pack-request
38-
> Accept: application/x-git-upload-pack-result
39-
> Content-Length: xxx
40-
< HTTP/1.1 200 OK
41-
< Pragma: no-cache
42-
< Cache-Control: no-cache, max-age=0, must-revalidate
43-
< Content-Type: application/x-git-upload-pack-result
44-
EOF
4526
test_expect_success 'clone http repository' '
27+
cat >exp <<-\EOF &&
28+
> GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1
29+
> Accept: */*
30+
> Accept-Encoding: ENCODINGS
31+
> Pragma: no-cache
32+
< HTTP/1.1 200 OK
33+
< Pragma: no-cache
34+
< Cache-Control: no-cache, max-age=0, must-revalidate
35+
< Content-Type: application/x-git-upload-pack-advertisement
36+
> POST /smart/repo.git/git-upload-pack HTTP/1.1
37+
> Accept-Encoding: ENCODINGS
38+
> Content-Type: application/x-git-upload-pack-request
39+
> Accept: application/x-git-upload-pack-result
40+
> Content-Length: xxx
41+
< HTTP/1.1 200 OK
42+
< Pragma: no-cache
43+
< Cache-Control: no-cache, max-age=0, must-revalidate
44+
< Content-Type: application/x-git-upload-pack-result
45+
EOF
4646
GIT_TRACE_CURL=true git clone --quiet $HTTPD_URL/smart/repo.git clone 2>err &&
4747
test_cmp file clone/file &&
4848
tr '\''\015'\'' Q <err |
@@ -96,13 +96,13 @@ test_expect_success 'fetch changes via http' '
9696
test_cmp file clone/file
9797
'
9898

99-
cat >exp <<EOF
100-
GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
101-
POST /smart/repo.git/git-upload-pack HTTP/1.1 200
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
104-
EOF
10599
test_expect_success 'used upload-pack service' '
100+
cat >exp <<-\EOF &&
101+
GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
102+
POST /smart/repo.git/git-upload-pack HTTP/1.1 200
103+
GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
104+
POST /smart/repo.git/git-upload-pack HTTP/1.1 200
105+
EOF
106106
check_access_log exp
107107
'
108108

@@ -203,15 +203,15 @@ test_expect_success 'dumb clone via http-backend respects namespace' '
203203
test_cmp expect actual
204204
'
205205

206-
cat >cookies.txt <<EOF
207-
127.0.0.1 FALSE /smart_cookies/ FALSE 0 othername othervalue
208-
EOF
209-
cat >expect_cookies.txt <<EOF
210-
211-
127.0.0.1 FALSE /smart_cookies/ FALSE 0 othername othervalue
212-
127.0.0.1 FALSE /smart_cookies/repo.git/info/ FALSE 0 name value
213-
EOF
214206
test_expect_success 'cookies stored in http.cookiefile when http.savecookies set' '
207+
cat >cookies.txt <<-\EOF &&
208+
127.0.0.1 FALSE /smart_cookies/ FALSE 0 othername othervalue
209+
EOF
210+
cat >expect_cookies.txt <<-\EOF &&
211+
212+
127.0.0.1 FALSE /smart_cookies/ FALSE 0 othername othervalue
213+
127.0.0.1 FALSE /smart_cookies/repo.git/info/ FALSE 0 name value
214+
EOF
215215
git config http.cookiefile cookies.txt &&
216216
git config http.savecookies true &&
217217
git ls-remote $HTTPD_URL/smart_cookies/repo.git master &&

0 commit comments

Comments
 (0)