From b407dd97a176d7d8eaa9acfc5dc4f04b8b7d8bf3 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 21 Nov 2024 14:18:41 +0800 Subject: [PATCH] enhance: reduce repository scanning time (#728) * skip special folders, such as `node_modules`, `.svn`, `.vs` .etc. * change max scanning depth to 5 Signed-off-by: leo --- src/ViewModels/ScanRepositories.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ViewModels/ScanRepositories.cs b/src/ViewModels/ScanRepositories.cs index 923413a3..be8af5ab 100644 --- a/src/ViewModels/ScanRepositories.cs +++ b/src/ViewModels/ScanRepositories.cs @@ -90,6 +90,13 @@ namespace SourceGit.ViewModels var subdirs = dir.GetDirectories("*", opts); foreach (var subdir in subdirs) { + if (subdir.Name.Equals("node_modules", StringComparison.Ordinal) || + subdir.Name.Equals(".svn", StringComparison.Ordinal) || + subdir.Name.Equals(".vs", StringComparison.Ordinal) || + subdir.Name.Equals(".vscode", StringComparison.Ordinal) || + subdir.Name.Equals(".idea", StringComparison.Ordinal)) + continue; + SetProgressDescription($"Scanning {subdir.FullName}..."); var normalizedSelf = subdir.FullName.Replace("\\", "/"); @@ -110,7 +117,7 @@ namespace SourceGit.ViewModels continue; } - if (depth < 8) + if (depth < 5) GetUnmanagedRepositories(subdir, outs, opts, depth + 1); } }