From 7f2ef33dde170e83a8943886a4f1502113dcb50c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iiro=20J=C3=A4ppinen?= Date: Sat, 14 Mar 2020 15:05:57 +0200 Subject: [PATCH] fix: force src and dst prefixes in diff to work around local diff.noprefix setting --- lib/gitWorkflow.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/gitWorkflow.js b/lib/gitWorkflow.js index d09583104..f1021bf05 100644 --- a/lib/gitWorkflow.js +++ b/lib/gitWorkflow.js @@ -35,8 +35,16 @@ const STASH = 'lint-staged automatic backup' const PATCH_UNSTAGED = 'lint-staged_unstaged.patch' +const GIT_DIFF_ARGS = [ + '--binary', // support binary files + '--unified=0', // do not add lines around diff for consistent behaviour + '--no-color', // disable colors for consistent behaviour + '--no-ext-diff', // disable external diff tools for consistent behaviour + '--src-prefix=a/', // force prefix for consistent behaviour + '--dst-prefix=b/', // force prefix for consistent behaviour + '--patch' // output a patch that can be applied +] const GIT_APPLY_ARGS = ['-v', '--whitespace=nowarn', '--recount', '--unidiff-zero'] -const GIT_DIFF_ARGS = ['--binary', '--unified=0', '--no-color', '--no-ext-diff', '--patch'] const handleError = (error, ctx) => { ctx.gitError = true