From 1bd4af7fa592c9cb8e6299c4fe8034b83f558d6d Mon Sep 17 00:00:00 2001 From: Naveen <172697+naveensrinivasan@users.noreply.github.com> Date: Wed, 13 Mar 2024 07:45:35 -0500 Subject: [PATCH] :bug: ignore .git folder for localdir (#3943) - ignore .git folder for localdir Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com> --- clients/localdir/client.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/clients/localdir/client.go b/clients/localdir/client.go index 2038108d1d2..e13ba10c72a 100644 --- a/clients/localdir/client.go +++ b/clients/localdir/client.go @@ -80,7 +80,6 @@ func isDir(p string) (bool, error) { if err != nil { return false, fmt.Errorf("%w", err) } - return fileInfo.IsDir(), nil } @@ -103,6 +102,11 @@ func listFiles(clientPath string) ([]string, error) { return err } if d { + // Check if the directory is .git. Use filepath.Base for compatibility across different OS path separators. + // ignoring the .git folder. + if filepath.Base(pathfn) == ".git" { + return fs.SkipDir + } return nil }