Skip to content

Commit

Permalink
Pre-populate username prompt if present in the URL
Browse files Browse the repository at this point in the history
  • Loading branch information
Keno committed Jul 27, 2016
1 parent 1d54b4f commit 7ba3ebd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions base/libgit2/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ function credentials_callback(cred::Ptr{Ptr{Void}}, url_ptr::Cstring,
# parse url for schema and host
urlparts = match(urlmatcher, url)
schema = urlparts.captures[1]
urlusername = urlparts.captures[4]
urlusername = urlusername === nothing ? "" : String(urlusername)
host = urlparts.captures[5]
schema = schema === nothing ? "" : schema*"://"

Expand Down Expand Up @@ -200,13 +202,14 @@ function credentials_callback(cred::Ptr{Ptr{Void}}, url_ptr::Cstring,
if is_windows()
if username === nothing || userpass === nothing || isusedcreds
res = Base.winprompt("Please enter your credentials for '$schema$host'", "Credentials required",
username === nothing ? "" : username; prompt_username = true)
username === nothing || isempty(username) ?
urlusername : username; prompt_username = true)
isnull(res) && return Cint(Error.EAUTH)
username, userpass = Base.get(res)
end
else
if username === nothing || isusedcreds
username = prompt("Username for '$schema$host'")
username = prompt("Username for '$schema$host'", default = urlusername)
end

if userpass === nothing || isusedcreds
Expand Down

0 comments on commit 7ba3ebd

Please sign in to comment.