Imported Upstream version 2.16.3
[platform/upstream/git.git] / t / lib-credential.sh
index 3c43ff1..937b831 100755 (executable)
@@ -18,10 +18,6 @@ check() {
                cat stderr &&
                false
        fi &&
-       if test_have_prereq MINGW
-       then
-               dos2unix -q stderr
-       fi &&
        test_cmp expect-stdout stdout &&
        test_cmp expect-stderr stderr
 }
@@ -48,6 +44,7 @@ helper_test_clean() {
        reject $1 https example.com user2
        reject $1 http path.tld user
        reject $1 https timeout.tld user
+       reject $1 https sso.tld
 }
 
 reject() {
@@ -254,6 +251,24 @@ helper_test() {
                password=pass2
                EOF
        '
+
+       test_expect_success "helper ($HELPER) can store empty username" '
+               check approve $HELPER <<-\EOF &&
+               protocol=https
+               host=sso.tld
+               username=
+               password=
+               EOF
+               check fill $HELPER <<-\EOF
+               protocol=https
+               host=sso.tld
+               --
+               protocol=https
+               host=sso.tld
+               username=
+               password=
+               EOF
+       '
 }
 
 helper_test_timeout() {
@@ -282,12 +297,10 @@ helper_test_timeout() {
        '
 }
 
-cat >askpass <<\EOF
-#!/bin/sh
+write_script askpass <<\EOF
 echo >&2 askpass: $*
-what=`echo $1 | cut -d" " -f1 | tr A-Z a-z | tr -cd a-z`
+what=$(echo $1 | cut -d" " -f1 | tr A-Z a-z | tr -cd a-z)
 echo "askpass-$what"
 EOF
-chmod +x askpass
 GIT_ASKPASS="$PWD/askpass"
 export GIT_ASKPASS