mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-09 04:54:16 +00:00
Merge pull request #55 from dupuy/avoid-markup-merge-conflict-fp
Don't report markup titles as merge conflicts
This commit is contained in:
commit
16a4e68d88
2 changed files with 5 additions and 4 deletions
|
|
@ -6,7 +6,8 @@ import sys
|
||||||
|
|
||||||
CONFLICT_PATTERNS = [
|
CONFLICT_PATTERNS = [
|
||||||
'<<<<<<< ',
|
'<<<<<<< ',
|
||||||
'=======',
|
'======= ',
|
||||||
|
'=======\n',
|
||||||
'>>>>>>> '
|
'>>>>>>> '
|
||||||
]
|
]
|
||||||
WARNING_MSG = 'Merge conflict string "{0}" found in {1}:{2}'
|
WARNING_MSG = 'Merge conflict string "{0}" found in {1}:{2}'
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ def f1_is_a_conflict_file(in_tmpdir):
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
'failing_contents', ('<<<<<<< HEAD', '=======', '>>>>>>> master'),
|
'failing_contents', ('<<<<<<< HEAD\n', '=======\n', '>>>>>>> master\n'),
|
||||||
)
|
)
|
||||||
@pytest.mark.usefixtures('f1_is_a_conflict_file')
|
@pytest.mark.usefixtures('f1_is_a_conflict_file')
|
||||||
def test_merge_conflicts_failing(failing_contents):
|
def test_merge_conflicts_failing(failing_contents):
|
||||||
|
|
@ -56,7 +56,7 @@ def test_merge_conflicts_failing(failing_contents):
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
'ok_contents', ('# <<<<<<< HEAD', '# =======', 'import my_module', ''),
|
'ok_contents', ('# <<<<<<< HEAD\n', '# =======\n', 'import my_module', ''),
|
||||||
)
|
)
|
||||||
@pytest.mark.usefixtures('f1_is_a_conflict_file')
|
@pytest.mark.usefixtures('f1_is_a_conflict_file')
|
||||||
def test_merge_conflicts_ok(ok_contents):
|
def test_merge_conflicts_ok(ok_contents):
|
||||||
|
|
@ -67,5 +67,5 @@ def test_merge_conflicts_ok(ok_contents):
|
||||||
@pytest.mark.usefixtures('in_tmpdir')
|
@pytest.mark.usefixtures('in_tmpdir')
|
||||||
def test_does_not_care_when_not_in_a_conflict():
|
def test_does_not_care_when_not_in_a_conflict():
|
||||||
with io.open('README.md', 'w') as readme_file:
|
with io.open('README.md', 'w') as readme_file:
|
||||||
readme_file.write('pre-commit\n=================\n')
|
readme_file.write('problem\n=======\n')
|
||||||
assert detect_merge_conflict(['README.md']) == 0
|
assert detect_merge_conflict(['README.md']) == 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue