fix considering base path when ignoring known bad unix paths (#2644)

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Alex Goodman
2024-02-14 15:57:38 -05:00
committed by GitHub
parent 8e62ff9831
commit a909e3cec9
6 changed files with 131 additions and 21 deletions
+1 -1
View File
@@ -197,7 +197,7 @@ func getDirectoryExclusionFunctions(root string, exclusions []string) ([]fileres
}
return []fileresolver.PathIndexVisitor{
func(path string, info os.FileInfo, _ error) error {
func(_, path string, info os.FileInfo, _ error) error {
for _, exclusion := range exclusions {
// this is required to handle Windows filepaths
path = filepath.ToSlash(path)
+1 -1
View File
@@ -392,7 +392,7 @@ func Test_getDirectoryExclusionFunctions_crossPlatform(t *testing.T) {
require.NoError(t, err)
for _, f := range fns {
result := f(test.path, test.finfo, nil)
result := f("", test.path, test.finfo, nil)
require.Equal(t, test.walkHint, result)
}
})
+1 -1
View File
@@ -177,7 +177,7 @@ func (s FileSource) FileResolver(_ Scope) (file.Resolver, error) {
exclusionFunctions = append([]fileresolver.PathIndexVisitor{
// note: we should exclude these kinds of paths first before considering any other user-provided exclusions
func(p string, _ os.FileInfo, _ error) error {
func(_, p string, _ os.FileInfo, _ error) error {
if p == absParentDir {
// this is the root directory... always include it
return nil