mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 09:17:53 +00:00
Upgrade test to work on windows. (#4815)
This commit is contained in:
committed by
GitHub
parent
1d7eb0d250
commit
5d4b02ca85
@@ -57,24 +57,15 @@ export class GitIgnoreParser implements GitIgnoreFilter {
|
||||
}
|
||||
|
||||
isIgnored(filePath: string): boolean {
|
||||
const relativePath = path.isAbsolute(filePath)
|
||||
? path.relative(this.projectRoot, filePath)
|
||||
: filePath;
|
||||
const resolved = path.resolve(this.projectRoot, filePath);
|
||||
const relativePath = path.relative(this.projectRoot, resolved);
|
||||
|
||||
if (
|
||||
relativePath === '' ||
|
||||
relativePath.startsWith('..') ||
|
||||
relativePath === '/' ||
|
||||
relativePath.startsWith('/')
|
||||
) {
|
||||
if (relativePath === '' || relativePath.startsWith('..')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let normalizedPath = relativePath.replace(/\\/g, '/');
|
||||
if (normalizedPath.startsWith('./')) {
|
||||
normalizedPath = normalizedPath.substring(2);
|
||||
}
|
||||
|
||||
// Even in windows, Ignore expects forward slashes.
|
||||
const normalizedPath = relativePath.replace(/\\/g, '/');
|
||||
return this.ig.ignores(normalizedPath);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user