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 b9d8182 commit c652593
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 === nothing && (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 c652593

Please sign in to comment.