From 25e75d4631c5642451f951538fd71e64f8372590 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Fri, 15 Jun 2018 15:53:20 -0500 Subject: [PATCH] add color suppression to all uses of `diff` and `status` verbs --- src/git/git.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/git/git.ts b/src/git/git.ts index 2de239b..246a3f5 100644 --- a/src/git/git.ts +++ b/src/git/git.ts @@ -359,7 +359,7 @@ export class Git { } static diff(repoPath: string, fileName: string, sha1?: string, sha2?: string, options: { encoding?: string } = {}) { - const params = ['diff', '--diff-filter=M', '-M', '--no-ext-diff', '--minimal']; + const params = ['-c', 'color.diff=false', 'diff', '--diff-filter=M', '-M', '--no-ext-diff', '--minimal']; if (sha1) { params.push(Git.isStagedUncommitted(sha1) ? '--staged' : sha1); } @@ -372,7 +372,7 @@ export class Git { } static diff_nameStatus(repoPath: string, sha1?: string, sha2?: string, options: { filter?: string } = {}) { - const params = ['diff', '--name-status', '-M', '--no-ext-diff']; + const params = ['-c', 'color.diff=false', 'diff', '--name-status', '-M', '--no-ext-diff']; if (options && options.filter) { params.push(`--diff-filter=${options.filter}`); } @@ -387,7 +387,7 @@ export class Git { } static diff_shortstat(repoPath: string, sha?: string) { - const params = ['diff', '--shortstat', '--no-ext-diff']; + const params = ['-c', 'color.diff=false', 'diff', '--shortstat', '--no-ext-diff']; if (sha) { params.push(sha); } @@ -640,14 +640,14 @@ export class Git { static status(repoPath: string, porcelainVersion: number = 1): Promise { const porcelain = porcelainVersion >= 2 ? `--porcelain=v${porcelainVersion}` : '--porcelain'; - return gitCommand({ cwd: repoPath, env: { ...process.env, GIT_OPTIONAL_LOCKS: '0' } }, 'status', porcelain, '--branch', '-u'); + return gitCommand({ cwd: repoPath, env: { ...process.env, GIT_OPTIONAL_LOCKS: '0' } }, '-c', 'color.status=false', 'status', porcelain, '--branch', '-u'); } static status_file(repoPath: string, fileName: string, porcelainVersion: number = 1): Promise { const [file, root] = Git.splitPath(fileName, repoPath); const porcelain = porcelainVersion >= 2 ? `--porcelain=v${porcelainVersion}` : '--porcelain'; - return gitCommand({ cwd: root, env: { ...process.env, GIT_OPTIONAL_LOCKS: '0' } }, 'status', porcelain, file); + return gitCommand({ cwd: root, env: { ...process.env, GIT_OPTIONAL_LOCKS: '0' } }, '-c', 'color.status=false', 'status', porcelain, file); } static tag(repoPath: string) {