@@ -431,7 +431,7 @@ fn with_authentication<T, F>(url: &str, cfg: &git2::Config, mut f: F)
431
431
// usernames during one authentication session with libgit2, so to
432
432
// handle this we bail out of this authentication session after setting
433
433
// the flag `ssh_username_requested`, and then we handle this below.
434
- if allowed. contains ( git2:: USERNAME ) {
434
+ if allowed. contains ( git2:: CredentialType :: USERNAME ) {
435
435
debug_assert ! ( username. is_none( ) ) ;
436
436
ssh_username_requested = true ;
437
437
return Err ( git2:: Error :: from_str ( "gonna try usernames later" ) )
@@ -445,7 +445,7 @@ fn with_authentication<T, F>(url: &str, cfg: &git2::Config, mut f: F)
445
445
// If we get called with this then the only way that should be possible
446
446
// is if a username is specified in the URL itself (e.g. `username` is
447
447
// Some), hence the unwrap() here. We try custom usernames down below.
448
- if allowed. contains ( git2:: SSH_KEY ) && !tried_sshkey {
448
+ if allowed. contains ( git2:: CredentialType :: SSH_KEY ) && !tried_sshkey {
449
449
// If ssh-agent authentication fails, libgit2 will keep
450
450
// calling this callback asking for other authentication
451
451
// methods to try. Make sure we only try ssh-agent once,
@@ -462,15 +462,15 @@ fn with_authentication<T, F>(url: &str, cfg: &git2::Config, mut f: F)
462
462
// but we currently don't! Right now the only way we support fetching a
463
463
// plaintext password is through the `credential.helper` support, so
464
464
// fetch that here.
465
- if allowed. contains ( git2:: USER_PASS_PLAINTEXT ) {
465
+ if allowed. contains ( git2:: CredentialType :: USER_PASS_PLAINTEXT ) {
466
466
let r = git2:: Cred :: credential_helper ( cfg, url, username) ;
467
467
cred_helper_bad = Some ( r. is_err ( ) ) ;
468
468
return r
469
469
}
470
470
471
471
// I'm... not sure what the DEFAULT kind of authentication is, but seems
472
472
// easy to support?
473
- if allowed. contains ( git2:: DEFAULT ) {
473
+ if allowed. contains ( git2:: CredentialType :: DEFAULT ) {
474
474
return git2:: Cred :: default ( )
475
475
}
476
476
@@ -507,10 +507,10 @@ fn with_authentication<T, F>(url: &str, cfg: &git2::Config, mut f: F)
507
507
// we bail out.
508
508
let mut attempts = 0 ;
509
509
res = f ( & mut |_url, username, allowed| {
510
- if allowed. contains ( git2:: USERNAME ) {
510
+ if allowed. contains ( git2:: CredentialType :: USERNAME ) {
511
511
return git2:: Cred :: username ( & s) ;
512
512
}
513
- if allowed. contains ( git2:: SSH_KEY ) {
513
+ if allowed. contains ( git2:: CredentialType :: SSH_KEY ) {
514
514
debug_assert_eq ! ( Some ( & s[ ..] ) , username) ;
515
515
attempts += 1 ;
516
516
if attempts == 1 {
0 commit comments