From 2b7f6cab4f9e033c6e74c74fea3bb88b20e180b9 Mon Sep 17 00:00:00 2001 From: Keno Fischer Date: Fri, 22 Jul 2016 17:17:13 -0400 Subject: [PATCH] Pre-populate username prompt if present in the URL --- base/libgit2/callbacks.jl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/base/libgit2/callbacks.jl b/base/libgit2/callbacks.jl index fd5a9624439388..61accfc3bba0ad 100644 --- a/base/libgit2/callbacks.jl +++ b/base/libgit2/callbacks.jl @@ -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*"://" @@ -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