summaryrefslogtreecommitdiff
path: root/ext/git/git.go
diff options
context:
space:
mode:
authorjannfis <jann@mistrust.net>2024-05-27 19:38:30 +0000
committerjannfis <jann@mistrust.net>2024-05-27 19:40:33 +0000
commit67f3d349f9fb60bb232cf6f0734a090bc48f5a4e (patch)
treef8b3731f82b98982d4f26ee598635d7932efed19 /ext/git/git.go
parenteb1d8d30bb22cb82928df64fd5028fa978f8cb5b (diff)
chore(deps): Pull in Git client changes from Argo CD v2.11.2
Signed-off-by: jannfis <jann@mistrust.net>
Diffstat (limited to 'ext/git/git.go')
-rw-r--r--ext/git/git.go10
1 files changed, 1 insertions, 9 deletions
diff --git a/ext/git/git.go b/ext/git/git.go
index b925789..d5a8652 100644
--- a/ext/git/git.go
+++ b/ext/git/git.go
@@ -14,14 +14,6 @@ func ensurePrefix(s, prefix string) string {
return s
}
-// removeSuffix idempotently removes a given suffix
-func removeSuffix(s, suffix string) string {
- if strings.HasSuffix(s, suffix) {
- return s[0 : len(s)-len(suffix)]
- }
- return s
-}
-
var (
commitSHARegex = regexp.MustCompile("^[0-9A-Fa-f]{40}$")
sshURLRegex = regexp.MustCompile("^(ssh://)?([^/:]*?)@[^@]+$")
@@ -62,7 +54,7 @@ func NormalizeGitURL(repo string) string {
repo = ensurePrefix(repo, "ssh://")
}
}
- repo = removeSuffix(repo, ".git")
+ repo = strings.TrimSuffix(repo, ".git")
repoURL, err := url.Parse(repo)
if err != nil {
return ""