aboutsummaryrefslogtreecommitdiff
path: root/t/t5540-http-push.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-09-07 11:09:49 -0700
committerJunio C Hamano <gitster@pobox.com>2012-09-07 11:09:50 -0700
commite6dd70e9bfef40d545cb0f452f082bde562e8785 (patch)
tree6ca29bfd8d3a36bfae9508c8756ff81e3a78b224 /t/t5540-http-push.sh
parent9192ece94b94ccbc061216517251400db691de86 (diff)
parentb81401c1de0e0fec39f8643ce7a794fda083f7a1 (diff)
downloadgit-e6dd70e9bfef40d545cb0f452f082bde562e8785.tar.gz
git-e6dd70e9bfef40d545cb0f452f082bde562e8785.tar.xz
Merge branch 'jk/maint-http-half-auth-push'
Pushing to smart HTTP server with recent Git fails without having the username in the URL to force authentication, if the server is configured to allow GET anonymously, while requiring authentication for POST. * jk/maint-http-half-auth-push: http: prompt for credentials on failed POST http: factor out http error code handling t: test http access to "half-auth" repositories t: test basic smart-http authentication t/lib-httpd: recognize */smart/* repos as smart-http t/lib-httpd: only route auth/dumb to dumb repos t5550: factor out http auth setup t5550: put auth-required repo in auth/dumb
Diffstat (limited to 't/t5540-http-push.sh')
-rwxr-xr-xt/t5540-http-push.sh17
1 files changed, 8 insertions, 9 deletions
diff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh
index 1eea64765..f141f2d1d 100755
--- a/t/t5540-http-push.sh
+++ b/t/t5540-http-push.sh
@@ -46,15 +46,7 @@ test_expect_success 'create password-protected repository' '
"$HTTPD_DOCUMENT_ROOT_PATH/auth/dumb/test_repo.git"
'
-test_expect_success 'setup askpass helper' '
- cat >askpass <<-\EOF &&
- #!/bin/sh
- echo user@host
- EOF
- chmod +x askpass &&
- GIT_ASKPASS="$PWD/askpass" &&
- export GIT_ASKPASS
-'
+setup_askpass_helper
test_expect_success 'clone remote repository' '
cd "$ROOT_PATH" &&
@@ -162,6 +154,7 @@ test_http_push_nonff "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git \
test_expect_success 'push to password-protected repository (user in URL)' '
test_commit pw-user &&
+ set_askpass user@host &&
git push "$HTTPD_URL_USER/auth/dumb/test_repo.git" HEAD &&
git rev-parse --verify HEAD >expect &&
git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/auth/dumb/test_repo.git" \
@@ -169,9 +162,15 @@ test_expect_success 'push to password-protected repository (user in URL)' '
test_cmp expect actual
'
+test_expect_failure 'user was prompted only once for password' '
+ expect_askpass pass user@host
+'
+
test_expect_failure 'push to password-protected repository (no user in URL)' '
test_commit pw-nouser &&
+ set_askpass user@host &&
git push "$HTTPD_URL/auth/dumb/test_repo.git" HEAD &&
+ expect_askpass both user@host
git rev-parse --verify HEAD >expect &&
git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/auth/dumb/test_repo.git" \
rev-parse --verify HEAD >actual &&