Skip to content

Commit

Permalink
chore: standardize temporary dir name prefix
Browse files Browse the repository at this point in the history
Avoids passing in an unnecessary param.

Addresses helm#11258 (comment)

Signed-off-by: Dominykas Blyžė <hello@dominykas.com>
  • Loading branch information
dominykas committed Dec 20, 2023
1 parent f42ea6b commit 68d4268
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions internal/gitutil/gitutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import (
var gitRepositoryURLRe = regexp.MustCompile(`^git(\+\w+)?://`)

// HasGitReference returns true if a git repository contains a specified ref (branch/tag)
func HasGitReference(gitRepo, ref, repoName string) (bool, error) {
local, err := os.MkdirTemp("", repoName)
func HasGitReference(gitRepo, ref string) (bool, error) {
local, err := os.MkdirTemp("", "helm-git-")
if err != nil {
return false, err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/resolver/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (r *Resolver) Resolve(reqs []*chart.Dependency, repoNames map[string]string

if gitutil.IsGitRepository(d.Repository) {

found, err := hasGitReference(gitutil.RepositoryURLToGitURL(d.Repository), d.Version, d.Name)
found, err := hasGitReference(gitutil.RepositoryURLToGitURL(d.Repository), d.Version)

if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion internal/resolver/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"helm.sh/helm/v3/pkg/registry"
)

func fakeGitReference(gitRepo, ref, repoName string) (bool, error) {
func fakeGitReference(gitRepo, ref string) (bool, error) {
gitRefs := map[string]string{
"1.0.0": "",
"main": "",
Expand Down
2 changes: 1 addition & 1 deletion pkg/getter/gitgetter.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (g *GitGetter) get(href string) (*bytes.Buffer, error) {
if version == "" {
return nil, fmt.Errorf("the version must be a valid tag or branch name for the git repo, not nil")
}
tmpDir, err := os.MkdirTemp("", "helm")
tmpDir, err := os.MkdirTemp("", "helm-git-")
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 68d4268

Please sign in to comment.