mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-05-13 11:59:12 -05:00
Fix merge conflict detection for cherry-pick conflict.
This commit is contained in:
+4
-1
@@ -23,7 +23,10 @@ def get_root():
|
||||
|
||||
|
||||
def is_in_merge_conflict():
|
||||
return os.path.exists(os.path.join('.git', 'MERGE_MSG'))
|
||||
return (
|
||||
os.path.exists(os.path.join('.git', 'MERGE_MSG')) and
|
||||
os.path.exists(os.path.join('.git', 'MERGE_HEAD'))
|
||||
)
|
||||
|
||||
|
||||
def parse_merge_msg_for_conflicts(merge_msg):
|
||||
|
||||
+9
-2
@@ -14,14 +14,21 @@ def test_get_root(empty_git_dir):
|
||||
assert git.get_root() == empty_git_dir
|
||||
|
||||
|
||||
def test_is_in_merge_conflict(empty_git_dir):
|
||||
def test_is_not_in_merge_conflict(empty_git_dir):
|
||||
assert git.is_in_merge_conflict() is False
|
||||
|
||||
|
||||
def test_is_not_in_merge_conflict(in_merge_conflict):
|
||||
def test_is_in_merge_conflict(in_merge_conflict):
|
||||
assert git.is_in_merge_conflict() is True
|
||||
|
||||
|
||||
def test_cherry_pick_conflict(in_merge_conflict):
|
||||
local['git']('merge', '--abort')
|
||||
foo_ref = local['git']('rev-parse', 'foo').strip()
|
||||
local['git']('cherry-pick', foo_ref, retcode=None)
|
||||
assert git.is_in_merge_conflict() is False
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def get_files_matching_func():
|
||||
def get_filenames():
|
||||
|
||||
Reference in New Issue
Block a user