git p4: Squash P4EDITOR in test harness
[gitweb.git] / t / t5550-http-fetch.sh
index 398a2d29a431c4218c4b56ba6728d930dc3a71c2..e5e6b8f643206c2d4fd01e3ad71ca50a43f3da19 100755 (executable)
@@ -53,7 +53,7 @@ test_expect_success 'setup askpass helpers' '
 '
 
 expect_askpass() {
-       dest=$HTTPD_DEST/auth/repo.git
+       dest=$HTTPD_DEST
        {
                case "$1" in
                none)
@@ -101,6 +101,34 @@ test_expect_success 'http auth can request both user and pass' '
        expect_askpass both user@host
 '
 
+test_expect_success 'http auth respects credential helper config' '
+       test_config_global credential.helper "!f() {
+               cat >/dev/null
+               echo username=user@host
+               echo password=user@host
+       }; f" &&
+       >askpass-query &&
+       echo wrong >askpass-response &&
+       git clone "$HTTPD_URL/auth/repo.git" clone-auth-helper &&
+       expect_askpass none
+'
+
+test_expect_success 'http auth can get username from config' '
+       test_config_global "credential.$HTTPD_URL.username" user@host &&
+       >askpass-query &&
+       echo user@host >askpass-response &&
+       git clone "$HTTPD_URL/auth/repo.git" clone-auth-user &&
+       expect_askpass pass user@host
+'
+
+test_expect_success 'configured username does not override URL' '
+       test_config_global "credential.$HTTPD_URL.username" wrong &&
+       >askpass-query &&
+       echo user@host >askpass-response &&
+       git clone "$HTTPD_URL_USER/auth/repo.git" clone-auth-user2 &&
+       expect_askpass pass user@host
+'
+
 test_expect_success 'fetch changes via http' '
        echo content >>file &&
        git commit -a -m two &&
@@ -134,8 +162,7 @@ test_expect_success 'http remote detects correct HEAD' '
 test_expect_success 'fetch packed objects' '
        cp -R "$HTTPD_DOCUMENT_ROOT_PATH"/repo.git "$HTTPD_DOCUMENT_ROOT_PATH"/repo_pack.git &&
        (cd "$HTTPD_DOCUMENT_ROOT_PATH"/repo_pack.git &&
-        git --bare repack &&
-        git --bare prune-packed
+        git --bare repack -a -d
        ) &&
        git clone $HTTPD_URL/dumb/repo_pack.git
 '