Code

diff: tweak a _copy_ of diff_options with word-diff
[git.git] / t / t0300-credentials.sh
index 42d0f5b7078ab405f70d71a9eeb7acb45b400ac6..c1c8108148351ab3ec3db3f2615ff88f29d38974 100755 (executable)
@@ -8,10 +8,13 @@ test_expect_success 'setup helper scripts' '
        cat >dump <<-\EOF &&
        whoami=`echo $0 | sed s/.*git-credential-//`
        echo >&2 "$whoami: $*"
-       while IFS== read key value; do
+       OIFS=$IFS
+       IFS==
+       while read key value; do
                echo >&2 "$whoami: $key=$value"
                eval "$key=$value"
        done
+       IFS=$OIFS
        EOF
 
        cat >git-credential-useless <<-\EOF &&
@@ -234,4 +237,46 @@ test_expect_success 'do not match configured credential' '
        EOF
 '
 
+test_expect_success 'pull username from config' '
+       test_config credential.https://example.com.username foo &&
+       check fill <<-\EOF
+       protocol=https
+       host=example.com
+       --
+       username=foo
+       password=askpass-password
+       --
+       askpass: Password for '\''https://foo@example.com'\'':
+       EOF
+'
+
+test_expect_success 'http paths can be part of context' '
+       check fill "verbatim foo bar" <<-\EOF &&
+       protocol=https
+       host=example.com
+       path=foo.git
+       --
+       username=foo
+       password=bar
+       --
+       verbatim: get
+       verbatim: protocol=https
+       verbatim: host=example.com
+       EOF
+       test_config credential.https://example.com.useHttpPath true &&
+       check fill "verbatim foo bar" <<-\EOF
+       protocol=https
+       host=example.com
+       path=foo.git
+       --
+       username=foo
+       password=bar
+       --
+       verbatim: get
+       verbatim: protocol=https
+       verbatim: host=example.com
+       verbatim: path=foo.git
+       EOF
+'
+
 test_done