Skip to content

Commit f385ea8

Browse files
committed
Fix issue when using pager
1 parent b9f75f5 commit f385ea8

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/git.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ describe("getDiffForFile", () => {
5656
const diffFromFile = getDiffForFile("./mockfile.js", true);
5757

5858
const expectedArguments =
59-
'git diff --diff-filter=ACM --relative --staged --unified=0 "1234567"';
59+
'git --no-pager diff --diff-filter=ACM --relative --staged --unified=0 "1234567"';
6060
expect(
6161
mockedChildProcess.execSync.mock.calls[
6262
mockedChildProcess.execSync.mock.calls.length - 1

src/git.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const getDiffForFile = (filePath: string, staged = false): string => {
2020
if (diff === undefined) {
2121
const command = [
2222
"git",
23+
"--no-pager",
2324
"diff",
2425
"--diff-filter=ACM",
2526
"--relative",
@@ -45,6 +46,7 @@ const getDiffFileList = (staged = false): string[] => {
4546
if (diffFileListCache === undefined) {
4647
const command = [
4748
"git",
49+
"--no-pager",
4850
"diff",
4951
"--diff-filter=ACM",
5052
"--name-only",
@@ -84,6 +86,7 @@ const getGitFileList = (): string[] => {
8486
const hasCleanIndex = (filePath: string): boolean => {
8587
const command = [
8688
"git",
89+
"--no-pager",
8790
"diff",
8891
"--quiet",
8992
"--relative",

0 commit comments

Comments
 (0)