Skip to content

Commit

Permalink
add and optimize changes from 0.2.12
Browse files Browse the repository at this point in the history
  • Loading branch information
Torathion committed Feb 20, 2025
1 parent 3b862df commit 32a5fce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/fdir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ export function buildFdir(options: GlobOptions, props: InternalProps, processed:
exclude: (_, p) => {
const relativePath = processPath(p, cwd, root, true, true);
const skipped = (relativePath !== '.' && !partialMatcher(relativePath)) || ignore(relativePath);
if (debug && !skipped) {
log(`crawling ${p}`);
if (debug) {
log(`${skipped ? 'skipped' : 'crawling'} ${p}`);
}
return skipped;
},
Expand Down
8 changes: 4 additions & 4 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ export function getPartialMatcher(patterns: string[], options?: PartialMatcherOp
regexes[i] = partRegexes;
}
return (input: string) => {
// no need to `splitPattern` as this is indeed not a pattern
const inputParts = input.split('/');
// if we only have patterns like `src/*` but the input is `../..`
// normally the parent directory would not get crawled
// and as such wrong results would be returned
// to avoid this always return true if the input only consists of .. ../.. etc
if (inputParts[0] === '..' && ONLY_PARENT_DIRECTORIES.test(input)) {
if (input.startsWith('..') && ONLY_PARENT_DIRECTORIES.test(input)) {
return true;
}
for (let i = 0; i < patterns.length; i++) {
// no need to `splitPattern` as this is indeed not a pattern
const inputParts = input.split('/');
for (let i = 0; i < patternsCount; i++) {
const patternParts = patternsParts[i];
const regex = regexes[i];
const inputPatternCount = inputParts.length;
Expand Down

0 comments on commit 32a5fce

Please sign in to comment.