@@ -37,7 +37,7 @@ function authenticate_ssh(creds::SSHCredentials, libgit2credptr::Ptr{Ptr{Void}},
3737 end
3838
3939 # first try ssh-agent if credentials support its usage
40- if creds. usesshagent === nothing || creds . usesshagent == " Y" || creds. usesshagent == " U"
40+ if creds. usesshagent == " Y" || creds. usesshagent == " U"
4141 err = ccall ((:git_cred_ssh_key_from_agent , :libgit2 ), Cint,
4242 (Ptr{Ptr{Void}}, Cstring), libgit2credptr, username_ptr)
4343 creds. usesshagent = " U" # used ssh-agent only one time
@@ -59,7 +59,6 @@ function authenticate_ssh(creds::SSHCredentials, libgit2credptr::Ptr{Ptr{Void}},
5959 ENV [" SSH_KEY_PATH" ]
6060 else
6161 keydefpath = creds. prvkey # check if credentials were already used
62- keydefpath === nothing && (keydefpath = " " )
6362 if isempty (keydefpath) || isusedcreds
6463 defaultkeydefpath = joinpath (homedir ()," .ssh" ," id_rsa" )
6564 if isempty (keydefpath) && isfile (defaultkeydefpath)
@@ -81,7 +80,6 @@ function authenticate_ssh(creds::SSHCredentials, libgit2credptr::Ptr{Ptr{Void}},
8180 ENV [" SSH_PUB_KEY_PATH" ]
8281 else
8382 keydefpath = creds. pubkey # check if credentials were already used
84- keydefpath === nothing && (keydefpath = " " )
8583 if isempty (keydefpath) || isusedcreds
8684 if isempty (keydefpath)
8785 keydefpath = privatekey* " .pub"
@@ -108,7 +106,6 @@ function authenticate_ssh(creds::SSHCredentials, libgit2credptr::Ptr{Ptr{Void}},
108106 ENV [" SSH_KEY_PASS" ]
109107 else
110108 passdef = creds. pass # check if credentials were already used
111- passdef === nothing && (passdef = " " )
112109 if passphrase_required && (isempty (passdef) || isusedcreds)
113110 if is_windows ()
114111 passdef = Base. winprompt (
@@ -133,10 +130,9 @@ function authenticate_ssh(creds::SSHCredentials, libgit2credptr::Ptr{Ptr{Void}},
133130 isusedcreds && return Cint (Error. EAUTH)
134131 end
135132
136- err = ccall ((:git_cred_ssh_key_new , :libgit2 ), Cint,
133+ return ccall ((:git_cred_ssh_key_new , :libgit2 ), Cint,
137134 (Ptr{Ptr{Void}}, Cstring, Cstring, Cstring, Cstring),
138135 libgit2credptr, creds. user, creds. pubkey, creds. prvkey, creds. pass)
139- return err
140136end
141137
142138function authenticate_userpass (creds:: UserPasswordCredentials , libgit2credptr:: Ptr{Ptr{Void}} ,
@@ -146,19 +142,16 @@ function authenticate_userpass(creds::UserPasswordCredentials, libgit2credptr::P
146142 if creds. prompt_if_incorrect
147143 username = creds. user
148144 userpass = creds. pass
149- (username === nothing ) && (username = " " )
150- (userpass === nothing ) && (userpass = " " )
151145 if is_windows ()
152146 if isempty (username) || isempty (userpass) || isusedcreds
153147 res = Base. winprompt (" Please enter your credentials for '$schema$host '" , " Credentials required" ,
154- username === nothing || isempty (username) ?
155- urlusername : username; prompt_username = true )
148+ isempty (username) ? urlusername : username; prompt_username = true )
156149 isnull (res) && return Cint (Error. EAUTH)
157150 username, userpass = Base. get (res)
158151 end
159152 elseif isusedcreds
160- username = prompt (" Username for '$schema$host '" , default = isempty (username) ?
161- urlusername : username)
153+ username = prompt (" Username for '$schema$host '" ,
154+ default = isempty (username) ? urlusername : username)
162155 userpass = prompt (" Password for '$schema$username @$host '" , password= true )
163156 end
164157 ((creds. user != username) || (creds. pass != userpass)) && reset! (creds)
@@ -170,10 +163,9 @@ function authenticate_userpass(creds::UserPasswordCredentials, libgit2credptr::P
170163 isusedcreds && return Cint (Error. EAUTH)
171164 end
172165
173- err = ccall ((:git_cred_userpass_plaintext_new , :libgit2 ), Cint,
166+ return ccall ((:git_cred_userpass_plaintext_new , :libgit2 ), Cint,
174167 (Ptr{Ptr{Void}}, Cstring, Cstring),
175168 libgit2credptr, creds. user, creds. pass)
176- err == 0 && return Cint (0 )
177169end
178170
179171
@@ -206,7 +198,7 @@ counting strategy that prevents repeated usage of faulty credentials.
206198function credentials_callback (libgit2credptr:: Ptr{Ptr{Void}} , url_ptr:: Cstring ,
207199 username_ptr:: Cstring ,
208200 allowed_types:: Cuint , payload_ptr:: Ptr{Void} )
209- err = 0
201+ err = Cint ( 0 )
210202 url = unsafe_string (url_ptr)
211203
212204 # parse url for schema and host
@@ -252,7 +244,7 @@ function credentials_callback(libgit2credptr::Ptr{Ptr{Void}}, url_ptr::Cstring,
252244 end
253245 err = Cint (Error. EAUTH)
254246 end
255- return Cint ( err)
247+ return err
256248end
257249
258250function fetchhead_foreach_callback (ref_name:: Cstring , remote_url:: Cstring ,
0 commit comments