From 69eec45fe2f92e87664b60ba5b12325b593bb342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Mon, 20 Dec 2021 16:00:42 +0100 Subject: [PATCH 1/2] Bump spinner to 1.18.0 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index fe082e3a3..f4cec974b 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( github.com/AlecAivazis/survey/v2 v2.3.2 github.com/MakeNowJust/heredoc v1.0.0 - github.com/briandowns/spinner v1.13.0 + github.com/briandowns/spinner v1.18.0 github.com/charmbracelet/glamour v0.3.0 github.com/cli/browser v1.1.0 github.com/cli/oauth v0.9.0 diff --git a/go.sum b/go.sum index fd9b7ae9d..0595e720c 100644 --- a/go.sum +++ b/go.sum @@ -62,8 +62,8 @@ github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuP github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= -github.com/briandowns/spinner v1.13.0 h1:q/Y9LtpwtvL0CRzXrAMj0keVXqNhBYUFg6tBOUiY8ek= -github.com/briandowns/spinner v1.13.0/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= +github.com/briandowns/spinner v1.18.0 h1:SJs0maNOs4FqhBwiJ3Gr7Z1D39/rukIVGQvpNZVHVcM= +github.com/briandowns/spinner v1.18.0/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/charmbracelet/glamour v0.3.0 h1:3H+ZrKlSg8s+WU6V7eF2eRVYt8lCueffbi7r2+ffGkc= github.com/charmbracelet/glamour v0.3.0/go.mod h1:TzF0koPZhqq0YVBNL100cPHznAAjVj7fksX2RInwjGw= From c240ab9137db008609a0c8406ce27b1ff54917df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Mon, 20 Dec 2021 16:09:46 +0100 Subject: [PATCH 2/2] Unconditionally resolve "ssh.github.com" to "github.com" Previously, only "github.com" mapped to "ssh.github.com" via ssh config was treated as "github.com". Now, any "ssh.github.com" host is treated as "github.com", even if it was initially aliased as something else in the user's ssh hostname mappings. --- git/ssh_config.go | 5 ++--- git/ssh_config_test.go | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/git/ssh_config.go b/git/ssh_config.go index a4e234a02..3c5056474 100644 --- a/git/ssh_config.go +++ b/git/ssh_config.go @@ -30,9 +30,8 @@ func (m SSHAliasMap) Translator() func(*url.URL) *url.URL { if !ok { return u } - // FIXME: cleanup domain logic - if strings.EqualFold(u.Hostname(), "github.com") && strings.EqualFold(resolvedHost, "ssh.github.com") { - return u + if strings.EqualFold(resolvedHost, "ssh.github.com") { + resolvedHost = "github.com" } newURL, _ := url.Parse(u.String()) newURL.Host = resolvedHost diff --git a/git/ssh_config_test.go b/git/ssh_config_test.go index f05ca303b..058617269 100644 --- a/git/ssh_config_test.go +++ b/git/ssh_config_test.go @@ -128,12 +128,14 @@ func Test_Translator(t *testing.T) { m := SSHAliasMap{ "gh": "github.com", "github.com": "ssh.github.com", + "my.gh.com": "ssh.github.com", } tr := m.Translator() cases := [][]string{ {"ssh://gh/o/r", "ssh://github.com/o/r"}, {"ssh://github.com/o/r", "ssh://github.com/o/r"}, + {"ssh://my.gh.com", "ssh://github.com"}, {"https://gh/o/r", "https://gh/o/r"}, } for _, c := range cases {