Skip to content

Commit

Permalink
use -z --stdin when running check-ignore, qualified guess for #37857
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Nov 14, 2017
1 parent 5a9df66 commit 30966af
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions extensions/git/src/repository.ts
Expand Up @@ -722,15 +722,17 @@ export class Repository implements Disposable {
return 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 => {
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 }));
}
Expand Down

0 comments on commit 30966af

Please sign in to comment.