From 5206ce244837fa5b88b5f1e2b8c52b9a70ac5d80 Mon Sep 17 00:00:00 2001 From: Sebastien Chemin Date: Fri, 9 Sep 2016 16:19:53 +0200 Subject: [PATCH] Fix file stashing with external diff tool When git is configured to use an external diff tool to show diffs (eg. 'git config diff.external mytool'), the stashing unstaged files will create an empty file that can't be recovered. Some modifications are permanently lost... Just disable the ext-diff of git diff to avoid any issue. Change-Id: I10a57ac2acbcb1f7219455f1958efd50d8452d6a --- pre_commit/staged_files_only.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pre_commit/staged_files_only.py b/pre_commit/staged_files_only.py index c8ee9c29..7719d28b 100644 --- a/pre_commit/staged_files_only.py +++ b/pre_commit/staged_files_only.py @@ -23,7 +23,7 @@ def staged_files_only(cmd_runner): retcode, diff_stdout_binary, _ = cmd_runner.run( [ 'git', 'diff', '--ignore-submodules', '--binary', '--exit-code', - '--no-color', + '--no-color', '--no-ext-diff', ], retcode=None, encoding=None,