From 8ee6a3cf3b9647623d0abee76b0303b379c36723 Mon Sep 17 00:00:00 2001 From: Bez Hermoso Date: Mon, 11 Sep 2023 10:09:10 -0700 Subject: [PATCH] feat: Support alternate SSH usernames i.e. non-standard GitHub Enterprise setups --- lua/openingh/utils.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/openingh/utils.lua b/lua/openingh/utils.lua index 30a58e9..10ddca6 100644 --- a/lua/openingh/utils.lua +++ b/lua/openingh/utils.lua @@ -37,8 +37,9 @@ function M.parse_gh_remote(url) -- ssh url can be of type: -- git@some.github.com:user_or_org/reponame.git -- ssh://git@some.github.com/user_or_org/reponame.git + -- ssh://org-12345@some.github.com/org/reponame.git -- .* is used for ssh:// since lua matching doesn't support optional groups, only chars - local ssh = { string.find(url, ".*git@(.*)[:/]([^/]*)/([^%s/]*)") } + local ssh = { string.find(url, ".*@(.*)[:/]([^/]*)/([^%s/]*)") } local matches = http[1] == nil and ssh or http if matches[1] == nil then