提交 5ca4bab8 编写于 作者: J Johannes Rieken

use -z --stdin when running check-ignore, qualified guess for #37857

上级 6933e2eb
......@@ -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 }));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册