Skip to content

Commit 9f470e7

Browse files
committed
Fix errors omitted when in subdirectory
1 parent 6e2cec1 commit 9f470e7

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/git.test.ts

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

5656
const expectedArguments =
57-
'git diff --diff-filter=ACM --staged --unified=0 "1234567"';
57+
'git diff --diff-filter=ACM --relative --staged --unified=0 "1234567"';
5858
expect(
5959
mockedChildProcess.execSync.mock.calls[
6060
mockedChildProcess.execSync.mock.calls.length - 1

src/git.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const getDiffForFile = (filePath: string, staged = false): string => {
2222
"git",
2323
"diff",
2424
"--diff-filter=ACM",
25+
"--relative",
2526
staged && "--staged",
2627
"--unified=0",
2728
JSON.stringify(process.env.ESLINT_PLUGIN_DIFF_COMMIT ?? "HEAD"),
@@ -47,6 +48,7 @@ const getDiffFileList = (staged = false): string[] => {
4748
"diff",
4849
"--diff-filter=ACM",
4950
"--name-only",
51+
"--relative",
5052
staged && "--staged",
5153
JSON.stringify(process.env.ESLINT_PLUGIN_DIFF_COMMIT ?? "HEAD"),
5254
]

0 commit comments

Comments
 (0)