From 2ed0081b92595f117c1864a99a9bfd4170a13d84 Mon Sep 17 00:00:00 2001 From: Dominik Braun Date: Fri, 4 Dec 2020 21:33:13 +0100 Subject: [PATCH] Only fail if the repository URLs are different Signed-off-by: Dominik Braun --- cmd/helm/repo_add.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd/helm/repo_add.go b/cmd/helm/repo_add.go index 1b09ece83..4c3e909d3 100644 --- a/cmd/helm/repo_add.go +++ b/cmd/helm/repo_add.go @@ -161,10 +161,13 @@ func (o *repoAddOptions) run(out io.Writer) error { if !o.forceUpdate && f.Has(o.name) { existing := f.Get(o.name) if c != *existing { - - // The input coming in for the name is different from what is already - // configured. Return an error. - return errors.Errorf("repository name (%s) already exists, please specify a different name", o.name) + // In case of of the repo URLs ends with a trailing slash and the other + // one doesn't, the config is considered to be different even though they + // refer to the same repository. + // Only fail with an error if the configs actually are different. + if c.URLWithTrailingSlash() != existing.URLWithTrailingSlash() { + return errors.Errorf("repository name (%s) already exists, please specify a different name", o.name) + } } // The add is idempotent so do nothing