Skip to content

Commit 6b8e204

Browse files
committed
♻️ Improve file exclusion pattern precision
Update regex patterns to match file paths more accurately by anchoring patterns to path boundaries. This prevents overly broad exclusions where patterns could match partial filenames or subdirectories. - Anchor directory patterns with (^|/) prefix and (/|$) suffix - Anchor .DS_Store with $ suffix to match complete filenames - Ensures exclusions only apply to intended files and directories
1 parent b398b2b commit 6b8e204

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/git/utils.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@ pub fn should_exclude_file(path: &str) -> bool {
6666
log_debug!("Checking if file should be excluded: {}", path);
6767
let exclude_patterns = vec![
6868
(String::from(r"(^|/)\.git(/|$)"), false), // Only exclude .git directory, not .github
69-
(String::from(r"\.svn"), false),
70-
(String::from(r"\.hg"), false),
71-
(String::from(r"\.DS_Store"), false),
72-
(String::from(r"node_modules"), false),
73-
(String::from(r"target"), false),
74-
(String::from(r"build"), false),
75-
(String::from(r"dist"), false),
76-
(String::from(r"\.vscode"), false),
77-
(String::from(r"\.idea"), false),
78-
(String::from(r"\.vs"), false),
69+
(String::from(r"(^|/)\.svn(/|$)"), false),
70+
(String::from(r"(^|/)\.hg(/|$)"), false),
71+
(String::from(r"(^|/)\.DS_Store$"), false),
72+
(String::from(r"(^|/)node_modules(/|$)"), false),
73+
(String::from(r"(^|/)target(/|$)"), false),
74+
(String::from(r"(^|/)build(/|$)"), false),
75+
(String::from(r"(^|/)dist(/|$)"), false),
76+
(String::from(r"(^|/)\.vscode(/|$)"), false),
77+
(String::from(r"(^|/)\.idea(/|$)"), false),
78+
(String::from(r"(^|/)\.vs(/|$)"), false),
7979
(String::from(r"package-lock\.json$"), true),
8080
(String::from(r"\.lock$"), true),
8181
(String::from(r"\.log$"), true),

0 commit comments

Comments
 (0)