File tree 4 files changed +17
-4
lines changed
4 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -682,6 +682,10 @@ IF (BUILD_CLAR)
682
682
ELSE ()
683
683
ADD_TEST (libgit2_clar libgit2_clar -v)
684
684
ENDIF ()
685
+
686
+ # Add a test target which runs the cred callback tests, to be
687
+ # called after setting the url and user
688
+ ADD_TEST (libgit2_clar-cred_callback libgit2_clar -v -sonline::clone::cred_callback)
685
689
ENDIF ()
686
690
687
691
IF (TAGS)
Original file line number Diff line number Diff line change @@ -36,4 +36,8 @@ build_script:
36
36
- cmd : |
37
37
if "%GENERATOR%"=="MSYS Makefiles" (C:\MinGW\msys\1.0\bin\sh --login /c/projects/libgit2/script/appveyor-mingw.sh)
38
38
test_script :
39
- - ps : ctest -V .
39
+ - ps : |
40
+ ctest -V -R libgit2_clar
41
+ $env:GITTEST_REMOTE_URL="https://github.com/libgit2/non-existent"
42
+ $env:GITTEST_REMOTE_USER="libgit2test"
43
+ ctest -V -R libgit2_clar-cred_callback
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ git daemon --listen=localhost --export-all --enable=receive-pack --base-path="$H
25
25
export GITTEST_REMOTE_URL=" git://localhost/test.git"
26
26
27
27
# Run the test suite
28
- ctest -V . || exit $?
28
+ ctest -V -R libgit2_clar || exit $?
29
29
30
30
# Now that we've tested the raw git protocol, let's set up ssh to we
31
31
# can do the push tests over it
@@ -56,3 +56,7 @@ if [ -e ./libgit2_clar ]; then
56
56
./libgit2_clar -sonline::clone::cred_callback || exit $?
57
57
fi
58
58
fi
59
+
60
+ export GITTEST_REMOTE_URL=" https://github.com/libgit2/non-existent"
61
+ export GITTEST_REMOTE_USER=" libgit2test"
62
+ ctest -V -R libgit2_clar-cred_callback
Original file line number Diff line number Diff line change @@ -926,10 +926,11 @@ static int winhttp_stream_read(
926
926
if (parse_unauthorized_response (s -> request , & allowed_types , & t -> auth_mechanism ) < 0 )
927
927
return -1 ;
928
928
929
- if (allowed_types &&
930
- (!t -> cred || 0 == (t -> cred -> credtype & allowed_types ))) {
929
+ if (allowed_types ) {
931
930
int cred_error = 1 ;
932
931
932
+ git_cred_free (t -> cred );
933
+ t -> cred = NULL ;
933
934
/* Start with the user-supplied credential callback, if present */
934
935
if (t -> owner -> cred_acquire_cb ) {
935
936
cred_error = t -> owner -> cred_acquire_cb (& t -> cred , t -> owner -> url ,
You can’t perform that action at this time.
0 commit comments