From 44f482a3cc361502a4d1112d6252ac19f684a73b Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Mon, 1 Jul 2019 13:14:47 -0700 Subject: [PATCH] Don't scan hidden directories (.git, etc) When checking for updated core files, don't scan inside UNIX hidden directories like .git. Scanning inside a GIT tree for a large project with many branches could take many minutes of runtime and multiple GB of RAM. This was seen in the Arduino core for the ESP8266, but is probably also an issue for other core development teams. Fixes #327 Signed-off-by: Earle F. Philhower, III --- builder_utils/utils.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/builder_utils/utils.go b/builder_utils/utils.go index 9b4cb536..0683475b 100644 --- a/builder_utils/utils.go +++ b/builder_utils/utils.go @@ -149,6 +149,10 @@ func findAllFilesInFolder(sourcePath string, recurse bool) ([]string, error) { } for _, folder := range folders { + // Skip any hidden directories (.git, .tmp, etc.) + if strings.HasPrefix(folder.Name(), ".") { + continue + } otherSources, err := findAllFilesInFolder(filepath.Join(sourcePath, folder.Name()), recurse) if err != nil { return nil, i18n.WrapError(err)