Skip to content

Commit eb5b6d5

Browse files
committed
fix: move warning to top of block
Emit the warning first to ensure it's always logged. This clarifies that any following errors are due to using a local chart instead of a remote repository. Signed-off-by: Feng Cao <24779889+shfc@users.noreply.github.com>
1 parent 6b5c944 commit eb5b6d5

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎pkg/action/install.go‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,12 @@ func (c *ChartPathOptions) LocateChart(name string, settings *cli.EnvSettings) (
751751
version := strings.TrimSpace(c.Version)
752752

753753
if _, err := os.Stat(name); err == nil {
754+
// Issue #7862: Helm prioritizes local charts over --repo flag.
755+
// This behavior is maintained for backwards compatibility but with a warning.
756+
if c.RepoURL != "" {
757+
slog.Warn("local chart found in current working directory. --repo flag ignored", "chart", name)
758+
}
759+
754760
abs, err := filepath.Abs(name)
755761
if err != nil {
756762
return abs, err
@@ -760,11 +766,6 @@ func (c *ChartPathOptions) LocateChart(name string, settings *cli.EnvSettings) (
760766
return "", err
761767
}
762768
}
763-
// Issue #7862: Helm prioritizes local charts over --repo flag.
764-
// This behavior is maintained for backwards compatibility but with a warning.
765-
if c.RepoURL != "" {
766-
slog.Warn("local chart found in current working directory. --repo flag ignored", "chart", name)
767-
}
768769
return abs, nil
769770
}
770771
if filepath.IsAbs(name) || strings.HasPrefix(name, ".") {

0 commit comments

Comments
 (0)