mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Fix patch applying when apply.whitespace=error
This commit is contained in:
parent
ec102a842a
commit
d5e2af7de5
2 changed files with 14 additions and 3 deletions
|
|
@ -340,7 +340,7 @@ bool_product = tuple(itertools.product((True, False), repeat=2))
|
|||
def test_crlf(in_git_dir, cmd_runner, crlf_before, crlf_after, autocrlf):
|
||||
cmd_output('git', 'config', '--local', 'core.autocrlf', autocrlf)
|
||||
|
||||
before, after = b'1\n2\n', b'3\n4\n'
|
||||
before, after = b'1\n2\n', b'3\n4\n\n'
|
||||
before = before.replace(b'\n', b'\r\n') if crlf_before else before
|
||||
after = after.replace(b'\n', b'\r\n') if crlf_after else after
|
||||
|
||||
|
|
@ -349,3 +349,8 @@ def test_crlf(in_git_dir, cmd_runner, crlf_before, crlf_after, autocrlf):
|
|||
_write(after)
|
||||
with staged_files_only(cmd_runner):
|
||||
assert_no_diff()
|
||||
|
||||
|
||||
def test_whitespace_errors(in_git_dir, cmd_runner):
|
||||
cmd_output('git', 'config', '--local', 'apply.whitespace', 'error')
|
||||
test_crlf(in_git_dir, cmd_runner, True, True, 'true')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue