diff --git a/cmd/helm/search.go b/cmd/helm/search.go index 287de252a..3c06aec47 100644 --- a/cmd/helm/search.go +++ b/cmd/helm/search.go @@ -60,7 +60,7 @@ func search(cmd *cobra.Command, args []string) error { func searchChartRefsForPattern(search string, chartRefs map[string]*repo.ChartRef) []string { matches := []string{} for k, c := range chartRefs { - if strings.Contains(c.Name, search) { + if strings.Contains(c.Name, search) && !c.Removed { matches = append(matches, k) continue } diff --git a/pkg/repo/repo.go b/pkg/repo/repo.go index ebc79f2c4..f8b4267f4 100644 --- a/pkg/repo/repo.go +++ b/pkg/repo/repo.go @@ -105,7 +105,6 @@ func LoadChartRepository(dir, url string) (*ChartRepository, error) { } return nil }) - return r, nil } @@ -124,6 +123,8 @@ func (r *ChartRepository) Index() error { r.IndexFile = &IndexFile{Entries: make(map[string]*ChartRef)} } + existCharts := map[string]bool{} + for _, path := range r.ChartPaths { ch, err := chartutil.Load(path) if err != nil { @@ -156,6 +157,15 @@ func (r *ChartRepository) Index() error { r.IndexFile.Entries[key] = entry + // chart is existing + existCharts[key] = true + } + + // update deleted charts with Removed = true + for k := range r.IndexFile.Entries { + if _, ok := existCharts[k]; !ok { + r.IndexFile.Entries[k].Removed = true + } } return r.saveIndexFile()