mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-04 19:26:52 +00:00
Fix check-merge-conflict against binary files
This commit is contained in:
parent
adbb569fe9
commit
4a01f64c8f
3 changed files with 16 additions and 6 deletions
|
|
@ -3,12 +3,14 @@ from __future__ import unicode_literals
|
|||
|
||||
import io
|
||||
import os
|
||||
import shutil
|
||||
|
||||
import pytest
|
||||
|
||||
from pre_commit_hooks.check_merge_conflict import detect_merge_conflict
|
||||
from pre_commit_hooks.util import cmd_output
|
||||
from testing.util import cwd
|
||||
from testing.util import get_resource_path
|
||||
from testing.util import write_file
|
||||
|
||||
|
||||
|
|
@ -109,6 +111,12 @@ def test_merge_conflicts_ok(ok_contents):
|
|||
assert detect_merge_conflict(['f1']) == 0
|
||||
|
||||
|
||||
@pytest.mark.usefixtures('f1_is_a_conflict_file')
|
||||
def test_ignores_binary_files():
|
||||
shutil.copy(get_resource_path('img1.jpg'), 'f1')
|
||||
assert detect_merge_conflict(['f1']) == 0
|
||||
|
||||
|
||||
@pytest.mark.usefixtures('in_tmpdir')
|
||||
def test_does_not_care_when_not_in_a_merge():
|
||||
with io.open('README.md', 'w') as readme_file:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue