mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-02-21 02:55:37 -08:00
parent
b2ab703ea2
commit
19ced2699d
|
@ -396,8 +396,8 @@ func (g *Git) getUpstreamIcon() string {
|
||||||
}
|
}
|
||||||
url = strings.TrimPrefix(url, "ssh://")
|
url = strings.TrimPrefix(url, "ssh://")
|
||||||
url = strings.TrimPrefix(url, "git://")
|
url = strings.TrimPrefix(url, "git://")
|
||||||
if strings.HasPrefix(url, "git@") {
|
if i := strings.Index(url, "@"); i >= 0 {
|
||||||
url = strings.TrimPrefix(url, "git@")
|
url = url[i+1:]
|
||||||
url = strings.Replace(url, ":", "/", 1)
|
url = strings.Replace(url, ":", "/", 1)
|
||||||
}
|
}
|
||||||
url = strings.TrimSuffix(url, ".git")
|
url = strings.TrimSuffix(url, ".git")
|
||||||
|
|
|
@ -597,6 +597,7 @@ func TestGitUpstream(t *testing.T) {
|
||||||
}{
|
}{
|
||||||
{Case: "No upstream", Expected: "", Upstream: ""},
|
{Case: "No upstream", Expected: "", Upstream: ""},
|
||||||
{Case: "SSH url", Expected: "G", Upstream: "ssh://git@git.my.domain:3001/ADIX7/dotconfig.git"},
|
{Case: "SSH url", Expected: "G", Upstream: "ssh://git@git.my.domain:3001/ADIX7/dotconfig.git"},
|
||||||
|
{Case: "Gitea", Expected: "EX", Upstream: "_gitea@src.example.com:user/repo.git"},
|
||||||
{Case: "GitHub", Expected: "GH", Upstream: "github.com/test"},
|
{Case: "GitHub", Expected: "GH", Upstream: "github.com/test"},
|
||||||
{Case: "Gitlab", Expected: "GL", Upstream: "gitlab.com/test"},
|
{Case: "Gitlab", Expected: "GL", Upstream: "gitlab.com/test"},
|
||||||
{Case: "Bitbucket", Expected: "BB", Upstream: "bitbucket.org/test"},
|
{Case: "Bitbucket", Expected: "BB", Upstream: "bitbucket.org/test"},
|
||||||
|
@ -619,6 +620,7 @@ func TestGitUpstream(t *testing.T) {
|
||||||
GitIcon: "G",
|
GitIcon: "G",
|
||||||
UpstreamIcons: map[string]string{
|
UpstreamIcons: map[string]string{
|
||||||
"mycustom.server": "CU",
|
"mycustom.server": "CU",
|
||||||
|
"src.example.com": "EX",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
g := &Git{
|
g := &Git{
|
||||||
|
|
Loading…
Reference in a new issue