mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Fix staged-files-only with a non-utf8-trailing-whitespace diff. Resolves #397
This commit is contained in:
parent
f11338ccfa
commit
b05cc4077e
2 changed files with 27 additions and 2 deletions
|
|
@ -45,7 +45,7 @@ def staged_files_only(cmd_runner):
|
|||
finally:
|
||||
# Try to apply the patch we saved
|
||||
try:
|
||||
cmd_runner.run(['git', 'apply', patch_filename])
|
||||
cmd_runner.run(('git', 'apply', patch_filename), encoding=None)
|
||||
except CalledProcessError:
|
||||
logger.warning(
|
||||
'Stashed changes conflicted with hook auto-fixes... '
|
||||
|
|
@ -55,7 +55,7 @@ def staged_files_only(cmd_runner):
|
|||
# by hooks.
|
||||
# Roll back the changes made by hooks.
|
||||
cmd_runner.run(['git', 'checkout', '--', '.'])
|
||||
cmd_runner.run(['git', 'apply', patch_filename])
|
||||
cmd_runner.run(('git', 'apply', patch_filename), encoding=None)
|
||||
logger.info('Restored changes from {0}.'.format(patch_filename))
|
||||
else:
|
||||
# There weren't any staged files so we don't need to do anything
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue