From a8ac5293447a2412228f45cf3a430dcd1e92951f Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Fri, 23 May 2025 04:46:05 -0400 Subject: [PATCH] fix: wrap subpath in '' (#2754) (#2755) Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> Co-authored-by: Jakub Panek --- pkg/runner/action_cache.go | 10 +++++----- pkg/runner/local_repository_cache.go | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/runner/action_cache.go b/pkg/runner/action_cache.go index 2b83aff..5c61e18 100644 --- a/pkg/runner/action_cache.go +++ b/pkg/runner/action_cache.go @@ -132,23 +132,23 @@ func (c GoGitActionCache) GetTarArchive(ctx context.Context, cacheDir, sha, incl gitPath := path.Join(c.Path, safeFilename(cacheDir)+".git") - logger.Infof("GoGitActionCache get content %s with sha %s subpath %s at %s", cacheDir, sha, includePrefix, gitPath) + logger.Infof("GoGitActionCache get content %s with sha %s subpath '%s' at %s", cacheDir, sha, includePrefix, gitPath) gogitrepo, err := git.PlainOpen(gitPath) if err != nil { - return nil, fmt.Errorf("GoGitActionCache failed to open bare git %s with sha %s subpath %s at %s: %w", cacheDir, sha, includePrefix, gitPath, err) + return nil, fmt.Errorf("GoGitActionCache failed to open bare git %s with sha %s subpath '%s' at %s: %w", cacheDir, sha, includePrefix, gitPath, err) } commit, err := gogitrepo.CommitObject(plumbing.NewHash(sha)) if err != nil { - return nil, fmt.Errorf("GoGitActionCache failed to get commit %s with sha %s subpath %s at %s: %w", cacheDir, sha, includePrefix, gitPath, err) + return nil, fmt.Errorf("GoGitActionCache failed to get commit %s with sha %s subpath '%s' at %s: %w", cacheDir, sha, includePrefix, gitPath, err) } t, err := commit.Tree() if err != nil { - return nil, fmt.Errorf("GoGitActionCache failed to open git tree %s with sha %s subpath %s at %s: %w", cacheDir, sha, includePrefix, gitPath, err) + return nil, fmt.Errorf("GoGitActionCache failed to open git tree %s with sha %s subpath '%s' at %s: %w", cacheDir, sha, includePrefix, gitPath, err) } files, err := commit.Files() if err != nil { - return nil, fmt.Errorf("GoGitActionCache failed to list files %s with sha %s subpath %s at %s: %w", cacheDir, sha, includePrefix, gitPath, err) + return nil, fmt.Errorf("GoGitActionCache failed to list files %s with sha %s subpath '%s' at %s: %w", cacheDir, sha, includePrefix, gitPath, err) } rpipe, wpipe := io.Pipe() // Interrupt io.Copy using ctx diff --git a/pkg/runner/local_repository_cache.go b/pkg/runner/local_repository_cache.go index 1065b65..67376a7 100644 --- a/pkg/runner/local_repository_cache.go +++ b/pkg/runner/local_repository_cache.go @@ -45,7 +45,7 @@ func (l *LocalRepositoryCache) GetTarArchive(ctx context.Context, cacheDir, sha, logger := common.Logger(ctx) // sha is mapped to ref in fetch if there is a local override if dest, ok := l.CacheDirCache[fmt.Sprintf("%s@%s", cacheDir, sha)]; ok { - logger.Infof("LocalRepositoryCache read cachedir %s with ref %s and subpath %s from %s", cacheDir, sha, includePrefix, dest) + logger.Infof("LocalRepositoryCache read cachedir %s with ref %s and subpath '%s' from %s", cacheDir, sha, includePrefix, dest) srcPath := filepath.Join(dest, includePrefix) buf := &bytes.Buffer{} tw := tar.NewWriter(buf) @@ -95,6 +95,6 @@ func (l *LocalRepositoryCache) GetTarArchive(ctx context.Context, cacheDir, sha, } return io.NopCloser(buf), nil } - logger.Infof("LocalRepositoryCache not matched cachedir %s with Ref %s and subpath %s", cacheDir, sha, includePrefix) + logger.Infof("LocalRepositoryCache not matched cachedir %s with Ref %s and subpath '%s'", cacheDir, sha, includePrefix) return l.Parent.GetTarArchive(ctx, cacheDir, sha, includePrefix) }