fix(git): do not process remote when empty

resolves #3377
This commit is contained in:
Jan De Dobbeleer 2023-01-20 21:27:59 +01:00 committed by Jan De Dobbeleer
parent 6fe030fd44
commit 19e0efc1fc
2 changed files with 5 additions and 0 deletions

View file

@ -390,7 +390,11 @@ func (g *Git) getUpstreamIcon() string {
url = strings.ReplaceAll(url, ":", "/")
return fmt.Sprintf("https://%s", url)
}
g.RawUpstreamURL = g.getRemoteURL()
if len(g.RawUpstreamURL) == 0 {
return ""
}
g.UpstreamURL = cleanSSHURL(g.RawUpstreamURL)
// allow overrides first

View file

@ -593,6 +593,7 @@ func TestGitUpstream(t *testing.T) {
Expected string
Upstream string
}{
{Case: "No upstream", Expected: "", Upstream: ""},
{Case: "GitHub", Expected: "GH", Upstream: "github.com/test"},
{Case: "Gitlab", Expected: "GL", Upstream: "gitlab.com/test"},
{Case: "Bitbucket", Expected: "BB", Upstream: "bitbucket.org/test"},