You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 19e1fce
Browse filesBrowse the repository at this point in the historyBrowse files
The `ignore` option was forwarded to the search that looks for the ignore files, so a pattern like `**/.gi*` hid `.gitignore` from it and nothing was ignored at all. It is still forwarded, since that is what keeps the search out of unreadable directories, but the patterns that could name one of the searched ignore files are now dropped.
Fixes#281
Copy file name to clipboardExpand all lines: index.d.ts
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,9 @@ export type Options = {
46
46
47
47
Gitignore patterns take priority over user patterns, matching Git's behavior. To include gitignored files, set this to `false`.
48
48
49
-
Performance: Globby reads `.gitignore` files before globbing. When there are no negation patterns (like `!important.log`) and no parent `.gitignore` files are found, it passes ignore patterns to fast-glob to skip traversing ignored directories entirely, which significantly improves performance for large `node_modules` or build directories. When negation patterns or parent `.gitignore` files are present, all filtering is done after traversal to ensure correct Git-compatible behavior. For optimal performance, prefer specific `.gitignore` patterns without negations, or use `ignoreFiles: '.gitignore'` to target only the root ignore file.
49
+
The `ignore` option applies to the results only. A pattern that could name an ignore file, such as `'**\/.gitignore'`, is not used when searching for the ignore files, so it hides them from the results without disabling this option.
50
+
51
+
Performance: Globby reads `.gitignore` files before globbing and hands fast-glob patterns for the directories it can prove are ignored, so whole ignored directories (like large `node_modules` or build outputs) are skipped during traversal instead of being enumerated and filtered afterwards. This holds even when negation patterns (like `!important.log`) or parent `.gitignore` files are present: only the rules that provably cannot be re-included by a negation are used to skip directories, while the final filtering always matches Git's behavior. To read fewer ignore files, use `ignoreFiles: '.gitignore'` to target only the root ignore file.
50
52
51
53
@default false
52
54
*/
@@ -57,6 +59,8 @@ export type Options = {
57
59
58
60
This is a more generic form of the `gitignore` option, allowing you to find ignore files with a [compatible syntax](http://git-scm.com/docs/gitignore). For instance, this works with Babel's `.babelignore`, Prettier's `.prettierignore`, or ESLint's `.eslintignore` files.
59
61
62
+
The `ignore` option applies to the results only, as with the `gitignore` option.
63
+
60
64
Performance tip: Using a specific path like `'.gitignore'` is much faster than recursive patterns.
61
65
62
66
@default undefined
@@ -137,6 +141,8 @@ export type GitignoreOptions = {
137
141
/**
138
142
Glob patterns to exclude from ignore file search.
139
143
144
+
Unlike the `ignore` option of `globby()`, which applies to the results only, this one excludes files from the search itself, so a pattern that names an ignore file stops that file from being read.
// The ignore files are searched for with the same options as the glob itself, except for `ignore`, which excludes paths from the results and must not decide which ignore files are read. The patterns that cannot hide one are still passed on, so the search keeps skipping the directories they name.
Copy file name to clipboardExpand all lines: readme.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,6 +93,8 @@ When enabled, globby searches for `.gitignore` files from the current working di
93
93
94
94
Gitignore patterns take priority over user patterns, matching Git's behavior. To include gitignored files, set this to `false`.
95
95
96
+
The `ignore` option applies to the results only. A pattern that could name an ignore file, such as `'**/.gitignore'`, is not used when searching for the ignore files, so it hides them from the results without disabling this option.
97
+
96
98
**Performance:** Globby reads `.gitignore` files before globbing and hands fast-glob patterns for the directories it can prove are ignored, so whole ignored directories (like large `node_modules` or build outputs) are skipped during traversal instead of being enumerated and filtered afterwards. This holds even when negation patterns (like `!important.log`) or parent `.gitignore` files are present: only the rules that provably cannot be re-included by a negation are used to skip directories, while the final filtering always matches Git's behavior. To read fewer ignore files, use `ignoreFiles: '.gitignore'` to target only the root ignore file.
97
99
98
100
##### globalGitignore
@@ -117,6 +119,8 @@ Glob patterns to look for ignore files, which are then used to ignore globbed fi
117
119
118
120
This is a more generic form of the `gitignore` option, allowing you to find ignore files with a [compatible syntax](http://git-scm.com/docs/gitignore). For instance, this works with Babel's `.babelignore`, Prettier's `.prettierignore`, or ESLint's `.eslintignore` files.
119
121
122
+
The `ignore` option applies to the results only, as with the [`gitignore`](#gitignore) option.
123
+
120
124
**Performance tip:** Using a specific path like `'.gitignore'` is much faster than recursive patterns.
121
125
122
126
##### expandNegationOnlyPatterns
@@ -248,6 +252,8 @@ Default: `[]`
248
252
249
253
Glob patterns to exclude from `.gitignore` file search.
250
254
255
+
Unlike the `ignore` option of [`globby()`](#options), which applies to the results only, this one excludes files from the search itself, so a pattern that names an ignore file stops that file from being read.
0 commit comments