Imported Upstream version 2.30.0
[platform/upstream/git.git] / t / t0300-credentials.sh
index bc2d740..a18f8a4 100755 (executable)
@@ -265,6 +265,32 @@ test_expect_success 'internal getpass does not ask for known username' '
        EOF
 '
 
+test_expect_success 'git-credential respects core.askPass' '
+       write_script alternate-askpass <<-\EOF &&
+       echo >&2 "alternate askpass invoked"
+       echo alternate-value
+       EOF
+       test_config core.askpass "$PWD/alternate-askpass" &&
+       (
+               # unset GIT_ASKPASS set by lib-credential.sh which would
+               # override our config, but do so in a subshell so that we do
+               # not interfere with other tests
+               sane_unset GIT_ASKPASS &&
+               check fill <<-\EOF
+               protocol=http
+               host=example.com
+               --
+               protocol=http
+               host=example.com
+               username=alternate-value
+               password=alternate-value
+               --
+               alternate askpass invoked
+               alternate askpass invoked
+               EOF
+       )
+'
+
 HELPER="!f() {
                cat >/dev/null
                echo username=foo