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 <jrnieder@gmail.com> Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Thomas Gummerer committed
Sep 17, 2018 at 22:46 UTC
92b7fd87bb8cb646fb6f9595bbb952b1f3af2e02
1 file changed
+33
-33
t/t5551-http-fetch-smart.sh
+33
-33
@@ -23,26 +23,26 @@ test_expect_success 'create http-accessible bare repository' '
23
24
setup_askpass_helper
25
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
26
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
46
GIT_TRACE_CURL=true git clone --quiet $HTTPD_URL/smart/repo.git clone 2>err &&
47
test_cmp file clone/file &&
48
tr '\''\015'\'' Q <err |
@@ -96,13 +96,13 @@ test_expect_success 'fetch changes via http' '
96
test_cmp file clone/file
97
'
98
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
99
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
106
check_access_log exp
107
'
108
@@ -203,15 +203,15 @@ test_expect_success 'dumb clone via http-backend respects namespace' '
203
test_cmp expect actual
204
'
205
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
206
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
215
git config http.cookiefile cookies.txt &&
216
git config http.savecookies true &&
217
git ls-remote $HTTPD_URL/smart_cookies/repo.git master &&