2015-11-18 16:46:39 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2018-07-10 18:48:02 +00:00
|
|
|
. "$(dirname "$0")/testlib.sh"
|
2015-11-18 16:46:39 +00:00
|
|
|
|
|
|
|
# these tests rely on GIT_TERMINAL_PROMPT to test properly
|
|
|
|
ensure_git_version_isnt $VERSION_LOWER "2.3.0"
|
|
|
|
|
|
|
|
begin_test "attempt private access without credential helper"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
|
|
|
reponame="$(basename "$0" ".sh")"
|
|
|
|
setup_remote_repo "$reponame"
|
|
|
|
clone_repo "$reponame" without-creds
|
|
|
|
|
|
|
|
git lfs track "*.dat"
|
|
|
|
echo "hi" > hi.dat
|
|
|
|
git add hi.dat
|
|
|
|
git add .gitattributes
|
|
|
|
git commit -m "initial commit"
|
|
|
|
|
2016-05-31 21:47:56 +00:00
|
|
|
git config --global credential.helper lfsnoop
|
|
|
|
git config credential.helper lfsnoop
|
|
|
|
git config -l
|
2015-11-18 16:46:39 +00:00
|
|
|
|
2016-08-02 19:47:05 +00:00
|
|
|
GIT_TERMINAL_PROMPT=0 git push origin master 2>&1 | tee push.log
|
2016-02-23 20:46:51 +00:00
|
|
|
grep "Authorization error: $GITSERVER/$reponame" push.log ||
|
|
|
|
grep "Git credentials for $GITSERVER/$reponame not found" push.log
|
2015-11-18 16:46:39 +00:00
|
|
|
)
|
|
|
|
end_test
|
2017-10-27 15:57:08 +00:00
|
|
|
|
|
|
|
begin_test "askpass: push with bad askpass"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
2017-10-27 16:28:48 +00:00
|
|
|
reponame="askpass-with-bad-askpass"
|
2017-10-27 15:57:08 +00:00
|
|
|
setup_remote_repo "$reponame"
|
|
|
|
clone_repo "$reponame" "$reponame"
|
|
|
|
|
|
|
|
git lfs track "*.dat"
|
|
|
|
echo "hello" > a.dat
|
|
|
|
|
|
|
|
git add .gitattributes a.dat
|
|
|
|
git commit -m "initial commit"
|
|
|
|
|
|
|
|
git config "credential.helper" ""
|
|
|
|
GIT_TERMINAL_PROMPT=0 GIT_ASKPASS="lfs-askpass-2" SSH_ASKPASS="dont-call-me" GIT_TRACE=1 git push origin master 2>&1 | tee push.log
|
|
|
|
grep "filling with GIT_ASKPASS" push.log # attempt askpass
|
|
|
|
grep 'credential fill error: exec: "lfs-askpass-2"' push.log # askpass fails
|
|
|
|
grep "creds: git credential fill" push.log # attempt git credential
|
|
|
|
)
|
|
|
|
end_test
|