Skip to content

Commit 00f1a76

Browse files
committed
Adds basic fuzziness to commit search by file
1 parent 54e349d commit 00f1a76

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/git/search.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,18 @@ export function getGitArgsFromSearchQuery(
234234

235235
files.push(value);
236236
} else {
237-
files.push(`${search.matchCase ? '' : ':(icase)'}${value}`);
237+
const prefix = search.matchCase ? '' : ':(icase)';
238+
if (/[/\\*?|![\]{}]/.test(value)) {
239+
files.push(`${prefix}${value}`);
240+
} else {
241+
const index = value.indexOf('.');
242+
if (index > 0) {
243+
// maybe a file extension
244+
files.push(`${prefix}**/${value}`);
245+
} else {
246+
files.push(`${prefix}*${value}*`);
247+
}
248+
}
238249
}
239250
}
240251

0 commit comments

Comments
 (0)