mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-02-02 05:41:10 -08:00
parent
19e0efc1fc
commit
25b29bc5bd
|
@ -384,10 +384,10 @@ func (g *Git) getUpstreamIcon() string {
|
|||
if strings.HasPrefix(url, "http") {
|
||||
return url
|
||||
}
|
||||
url = strings.TrimPrefix(url, "ssh://")
|
||||
url = strings.TrimPrefix(url, "git://")
|
||||
url = strings.TrimPrefix(url, "git@")
|
||||
url = strings.TrimSuffix(url, ".git")
|
||||
url = strings.ReplaceAll(url, ":", "/")
|
||||
return fmt.Sprintf("https://%s", url)
|
||||
}
|
||||
|
||||
|
|
|
@ -594,6 +594,7 @@ func TestGitUpstream(t *testing.T) {
|
|||
Upstream string
|
||||
}{
|
||||
{Case: "No upstream", Expected: "", Upstream: ""},
|
||||
{Case: "SSH url", Expected: "G", Upstream: "ssh://git@git.my.domain:3001/ADIX7/dotconfig.git"},
|
||||
{Case: "GitHub", Expected: "GH", Upstream: "github.com/test"},
|
||||
{Case: "Gitlab", Expected: "GL", Upstream: "gitlab.com/test"},
|
||||
{Case: "Bitbucket", Expected: "BB", Upstream: "bitbucket.org/test"},
|
||||
|
|
Loading…
Reference in a new issue