Skip to content

Commit 9ee6bcd

Browse files
rctaygitster
authored andcommitted
t5541-http-push: add test for URLs with trailing slash
Signed-off-by: Tay Ray Chuan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e923eae commit 9ee6bcd

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

t/t5541-http-push.sh

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,34 @@ test_expect_success 'setup remote repository' '
3434
mv test_repo.git "$HTTPD_DOCUMENT_ROOT_PATH"
3535
'
3636

37-
test_expect_success 'clone remote repository' '
37+
cat >exp <<EOF
38+
GET /smart/test_repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
39+
POST /smart/test_repo.git/git-upload-pack HTTP/1.1 200
40+
EOF
41+
test_expect_failure 'no empty path components' '
42+
# In the URL, add a trailing slash, and see if git appends yet another
43+
# slash.
3844
cd "$ROOT_PATH" &&
45+
git clone $HTTPD_URL/smart/test_repo.git/ test_repo_clone &&
46+
47+
sed -e "
48+
s/^.* \"//
49+
s/\"//
50+
s/ [1-9][0-9]*\$//
51+
s/^GET /GET /
52+
" >act <"$HTTPD_ROOT_PATH"/access.log &&
53+
54+
# Clear the log, so that it does not affect the "used receive-pack
55+
# service" test which reads the log too.
56+
#
57+
# We do this before the actual comparison to ensure the log is cleared.
58+
echo > "$HTTPD_ROOT_PATH"/access.log &&
59+
60+
test_cmp exp act
61+
'
62+
63+
test_expect_success 'clone remote repository' '
64+
rm -rf test_repo_clone &&
3965
git clone $HTTPD_URL/smart/test_repo.git test_repo_clone
4066
'
4167

@@ -68,6 +94,7 @@ test_expect_success 'create and delete remote branch' '
6894
'
6995

7096
cat >exp <<EOF
97+
7198
GET /smart/test_repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
7299
POST /smart/test_repo.git/git-upload-pack HTTP/1.1 200
73100
GET /smart/test_repo.git/info/refs?service=git-receive-pack HTTP/1.1 200

0 commit comments

Comments
 (0)