Skip to content

Commit 886f9c2

Browse files
committed
1 parent 0e8383e commit 886f9c2

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

extensions/git/src/util.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,10 @@ export function detectUnicodeEncoding(buffer: Buffer): Encoding | null {
303303
return null;
304304
}
305305

306+
function isWindowsPath(path: string): boolean {
307+
return /^[a-zA-Z]:\\/.test(path);
308+
}
309+
306310
export function isDescendant(parent: string, descendant: string): boolean {
307311
if (parent === descendant) {
308312
return true;
@@ -312,5 +316,11 @@ export function isDescendant(parent: string, descendant: string): boolean {
312316
parent += sep;
313317
}
314318

319+
// Windows is case insensitive
320+
if (isWindowsPath(parent)) {
321+
parent = parent.toLowerCase();
322+
descendant = descendant.toLowerCase();
323+
}
324+
315325
return descendant.startsWith(parent);
316326
}

0 commit comments

Comments
 (0)