From febc9510c4e2b275368b3a820f73a8bfe855997f Mon Sep 17 00:00:00 2001 From: Shunsuke Suzuki Date: Fri, 17 Nov 2023 11:40:16 +0900 Subject: [PATCH] fix(policy): fix a bug that the Git Repository root's policy file doesn't work well in working trees (#2479) - https://github.com/orgs/aquaproj/discussions/2476 --- pkg/policy/config_finder.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/policy/config_finder.go b/pkg/policy/config_finder.go index 2589e2bb4..1ef365acd 100644 --- a/pkg/policy/config_finder.go +++ b/pkg/policy/config_finder.go @@ -70,7 +70,9 @@ func (f *ConfigFinderImpl) Find(policyFilePath, wd string) (string, error) { } func (f *ConfigFinderImpl) exist(p string) bool { - b, err := afero.IsDir(f.fs, p) + // https://github.com/orgs/aquaproj/discussions/2476 + // Using `git worktree`, .git is a file. + b, err := afero.Exists(f.fs, p) if err != nil { return false }