mirror of
https://github.com/microsoft/vscode.git
synced 2026-02-23 19:27:15 +00:00
use -z --stdin when running check-ignore, qualified guess for #37857
This commit is contained in:
@@ -756,15 +756,17 @@ export class Repository implements Disposable {
|
||||
return Promise.resolve(new Set<string>());
|
||||
}
|
||||
|
||||
const child = this.repository.stream(['check-ignore', ...filePaths]);
|
||||
// https://git-scm.com/docs/git-check-ignore#git-check-ignore--z
|
||||
const child = this.repository.stream(['check-ignore', '-z', '--stdin'], { stdio: [null, null, null] });
|
||||
child.stdin.end(filePaths.join('\0'), 'utf8');
|
||||
|
||||
const onExit = (exitCode: number) => {
|
||||
if (exitCode === 1) {
|
||||
// nothing ignored
|
||||
resolve(new Set<string>());
|
||||
} else if (exitCode === 0) {
|
||||
// each line is something ignored
|
||||
resolve(new Set<string>(data.split('\n')));
|
||||
// paths are separated by the null-character
|
||||
resolve(new Set<string>(data.split('\0')));
|
||||
} else {
|
||||
reject(new GitError({ stdout: data, stderr, exitCode }));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user