fix(helm): replace repo entry instead of duplicating

Closes #1522
pull/1529/head
Matt Butcher 9 years ago
parent e4bbe33e92
commit c616bb5a98
No known key found for this signature in database
GPG Key ID: DCD5F5E5EF32C345

@ -113,15 +113,19 @@ func (r *RepoFile) Add(re ...*Entry) {
// entry with the same name doesn't exist in the repo file it will add it. // entry with the same name doesn't exist in the repo file it will add it.
func (r *RepoFile) Update(re ...*Entry) { func (r *RepoFile) Update(re ...*Entry) {
for _, target := range re { for _, target := range re {
found := false
for j, repo := range r.Repositories { for j, repo := range r.Repositories {
if repo.Name == target.Name { if repo.Name == target.Name {
r.Repositories[j] = target r.Repositories[j] = target
found = true
break break
} }
} }
if !found {
r.Add(target) r.Add(target)
} }
} }
}
// Has returns true if the given name is already a repository name. // Has returns true if the given name is already a repository name.
func (r *RepoFile) Has(name string) bool { func (r *RepoFile) Has(name string) bool {

Loading…
Cancel
Save