Skip to content

Commit f1449a5

Browse files
peffgitster
authored andcommitted
t5541: simplify and move "no empty path components" test
Commit 9ee6bcd (t5541-http-push: add test for URLs with trailing slash, 2010-04-08) added a test that clones a URL with a trailing slash, and confirms that we don't send a doubled slash (like "$url//info/refs") to the server. But this test makes no sense in t5541, which is about pushing. It should have been added in t5551. Let's move it there. But putting it at the end is tricky, since it checks the entire contents of the Apache access log. We could get around this by clearing the log before our test. But there's an even simpler solution: just make sure no doubled slashes appear in the log (fortunately, "http://" does not appear in the log itself). As a bonus, this also lets us drop the check for the v0 protocol (which is otherwise necessary since v2 makes multiple requests, and check_access_log insists on exactly matching the number of requests, even though we don't care about that here). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6ec90b5 commit f1449a5

File tree

2 files changed

+9
-18
lines changed

2 files changed

+9
-18
lines changed

t/t5541-http-push-smart.sh

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,6 @@ test_expect_success 'setup remote repository' '
3636

3737
setup_askpass_helper
3838

39-
cat >exp <<EOF
40-
GET /smart/test_repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
41-
POST /smart/test_repo.git/git-upload-pack HTTP/1.1 200
42-
EOF
43-
test_expect_success 'no empty path components' '
44-
# In the URL, add a trailing slash, and see if git appends yet another
45-
# slash.
46-
cd "$ROOT_PATH" &&
47-
git clone $HTTPD_URL/smart/test_repo.git/ test_repo_clone &&
48-
49-
# NEEDSWORK: If the overspecification of the expected result is reduced, we
50-
# might be able to run this test in all protocol versions.
51-
if test "$GIT_TEST_PROTOCOL_VERSION" = 0
52-
then
53-
check_access_log exp
54-
fi
55-
'
56-
5739
test_expect_success 'clone remote repository' '
5840
rm -rf test_repo_clone &&
5941
git clone $HTTPD_URL/smart/test_repo.git test_repo_clone &&

t/t5551-http-fetch-smart.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,4 +666,13 @@ test_expect_success 'push warns or fails when using username:password' '
666666
test_line_count -ge 1 warnings
667667
'
668668

669+
test_expect_success 'no empty path components' '
670+
# In the URL, add a trailing slash, and see if git appends yet another
671+
# slash.
672+
git clone $HTTPD_URL/smart/repo.git/ clone-with-slash &&
673+
674+
strip_access_log >log &&
675+
! grep "//" log
676+
'
677+
669678
test_done

0 commit comments

Comments
 (0)