Commit 66a530eb by Carlos Martín Nieto

Merge pull request #3648 from libgit2/cmn/auth-retry

test: make sure we retry the auth callback on all platforms
parents 778fb695 ba9bb664
...@@ -682,6 +682,10 @@ IF (BUILD_CLAR) ...@@ -682,6 +682,10 @@ IF (BUILD_CLAR)
ELSE () ELSE ()
ADD_TEST(libgit2_clar libgit2_clar -v) ADD_TEST(libgit2_clar libgit2_clar -v)
ENDIF () ENDIF ()
# Add a test target which runs the cred callback tests, to be
# called after setting the url and user
ADD_TEST(libgit2_clar-cred_callback libgit2_clar -v -sonline::clone::cred_callback)
ENDIF () ENDIF ()
IF (TAGS) IF (TAGS)
......
...@@ -36,4 +36,8 @@ build_script: ...@@ -36,4 +36,8 @@ build_script:
- cmd: | - cmd: |
if "%GENERATOR%"=="MSYS Makefiles" (C:\MinGW\msys\1.0\bin\sh --login /c/projects/libgit2/script/appveyor-mingw.sh) if "%GENERATOR%"=="MSYS Makefiles" (C:\MinGW\msys\1.0\bin\sh --login /c/projects/libgit2/script/appveyor-mingw.sh)
test_script: test_script:
- ps: ctest -V . - ps: |
ctest -V -R libgit2_clar
$env:GITTEST_REMOTE_URL="https://github.com/libgit2/non-existent"
$env:GITTEST_REMOTE_USER="libgit2test"
ctest -V -R libgit2_clar-cred_callback
...@@ -25,7 +25,7 @@ git daemon --listen=localhost --export-all --enable=receive-pack --base-path="$H ...@@ -25,7 +25,7 @@ git daemon --listen=localhost --export-all --enable=receive-pack --base-path="$H
export GITTEST_REMOTE_URL="git://localhost/test.git" export GITTEST_REMOTE_URL="git://localhost/test.git"
# Run the test suite # Run the test suite
ctest -V . || exit $? ctest -V -R libgit2_clar || exit $?
# Now that we've tested the raw git protocol, let's set up ssh to we # Now that we've tested the raw git protocol, let's set up ssh to we
# can do the push tests over it # can do the push tests over it
...@@ -56,3 +56,7 @@ if [ -e ./libgit2_clar ]; then ...@@ -56,3 +56,7 @@ if [ -e ./libgit2_clar ]; then
./libgit2_clar -sonline::clone::cred_callback || exit $? ./libgit2_clar -sonline::clone::cred_callback || exit $?
fi fi
fi fi
export GITTEST_REMOTE_URL="https://github.com/libgit2/non-existent"
export GITTEST_REMOTE_USER="libgit2test"
ctest -V -R libgit2_clar-cred_callback
...@@ -926,10 +926,11 @@ replay: ...@@ -926,10 +926,11 @@ replay:
if (parse_unauthorized_response(s->request, &allowed_types, &t->auth_mechanism) < 0) if (parse_unauthorized_response(s->request, &allowed_types, &t->auth_mechanism) < 0)
return -1; return -1;
if (allowed_types && if (allowed_types) {
(!t->cred || 0 == (t->cred->credtype & allowed_types))) {
int cred_error = 1; int cred_error = 1;
git_cred_free(t->cred);
t->cred = NULL;
/* Start with the user-supplied credential callback, if present */ /* Start with the user-supplied credential callback, if present */
if (t->owner->cred_acquire_cb) { if (t->owner->cred_acquire_cb) {
cred_error = t->owner->cred_acquire_cb(&t->cred, t->owner->url, cred_error = t->owner->cred_acquire_cb(&t->cred, t->owner->url,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment