Skip to content

Commit

Permalink
Prefer --find-renames over -M
Browse files Browse the repository at this point in the history
  • Loading branch information
paleite committed Jul 19, 2022
1 parent 7727a9b commit d03599a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/__fixtures__/postprocessArguments.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import type { Linter } from "eslint";

const postprocessArguments: [Linter.LintMessage[][], string] = [
const postprocessArguments: [
[[Linter.LintMessage, ...Linter.LintMessage[]], ...Linter.LintMessage[][]],
string
] = [
[
[
{
Expand Down
2 changes: 1 addition & 1 deletion src/git.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe("getDiffForFile", () => {

const expectedCommand = "git";
const expectedArgs =
'diff --no-ext-diff --diff-algorithm=histogram --diff-filter=ACM -M100% --relative --staged --unified=0 1234567';
"diff --diff-algorithm=histogram --diff-filter=ACM --find-renames=100% --no-ext-diff --relative --staged --unified=0 1234567";

const lastCall = mockedChildProcess.execFileSync.mock.calls.at(-1);
const [command, argsIncludingFile = []] = lastCall ?? [""];
Expand Down
8 changes: 4 additions & 4 deletions src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ const COMMAND = "git";
const getDiffForFile = (filePath: string, staged = false): string => {
const args = [
"diff",
"--no-ext-diff",
"--diff-algorithm=histogram",
"--diff-filter=ACM",
"-M100%",
"--find-renames=100%",
"--no-ext-diff",
"--relative",
staged && "--staged",
"--unified=0",
Expand All @@ -28,11 +28,11 @@ const getDiffForFile = (filePath: string, staged = false): string => {
const getDiffFileList = (): string[] => {
const args = [
"diff",
"--no-ext-diff",
"--diff-algorithm=histogram",
"--diff-filter=ACM",
"-M100%",
"--find-renames=100%",
"--name-only",
"--no-ext-diff",
"--relative",
"--staged",
process.env.ESLINT_PLUGIN_DIFF_COMMIT ?? "HEAD",
Expand Down

0 comments on commit d03599a

Please sign in to comment.