From c9e60866440d9bd0925a31ce6edbc7ceed9a4000 Mon Sep 17 00:00:00 2001 From: ahrav Date: Fri, 1 Sep 2023 10:38:51 -0700 Subject: [PATCH] Correctly create azure git links. (#1743) --- pkg/giturl/giturl.go | 4 ++-- pkg/giturl/giturl_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/giturl/giturl.go b/pkg/giturl/giturl.go index 0fdc200e6..d35809840 100644 --- a/pkg/giturl/giturl.go +++ b/pkg/giturl/giturl.go @@ -132,9 +132,9 @@ func GenerateLink(repo, commit, file string, line int64) string { return baseLink case providerAzure: - baseLink := repo + "?path=" + file + "&version=GB" + commit + baseLink := repo + "/commit/" + commit + "/" + file if line > 0 { - baseLink += "&line=" + strconv.FormatInt(line, 10) + baseLink += "?line=" + strconv.FormatInt(line, 10) } return baseLink diff --git a/pkg/giturl/giturl_test.go b/pkg/giturl/giturl_test.go index 69c0556ce..8035ba515 100644 --- a/pkg/giturl/giturl_test.go +++ b/pkg/giturl/giturl_test.go @@ -148,7 +148,7 @@ func TestGenerateLink(t *testing.T) { commit: "abcdef", file: "main.go", }, - want: "https://dev.azure.com/org/project/_git/repo?path=main.go&version=GBabcdef", + want: "https://dev.azure.com/org/project/_git/repo/commit/abcdef/main.go", }, { name: "Azure link gen with line", @@ -158,7 +158,7 @@ func TestGenerateLink(t *testing.T) { file: "main.go", line: int64(20), }, - want: "https://dev.azure.com/org/project/_git/repo?path=main.go&version=GBabcdef&line=20", + want: "https://dev.azure.com/org/project/_git/repo/commit/abcdef/main.go?line=20", }, } for _, tt := range tests {