mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-05 11:36:54 +00:00
Refactor check-merge-conflicts tests
Do a straight test of detecting a real merge conflict as generated by git. Test artificial conflict detection while pending merge without a real conflict. Test artificial non-conflict non-detection in a resolved merge conflict. Rename test_does_not_care... function to reflect what we want to care about. Rename is_in_merge_conflict to is_in_merge since that is what it checks.
This commit is contained in:
parent
eefc46f901
commit
5c752935fd
2 changed files with 42 additions and 6 deletions
|
|
@ -13,7 +13,7 @@ CONFLICT_PATTERNS = [
|
|||
WARNING_MSG = 'Merge conflict string "{0}" found in {1}:{2}'
|
||||
|
||||
|
||||
def is_in_merge_conflict():
|
||||
def is_in_merge():
|
||||
return (
|
||||
os.path.exists(os.path.join('.git', 'MERGE_MSG')) and
|
||||
os.path.exists(os.path.join('.git', 'MERGE_HEAD'))
|
||||
|
|
@ -25,7 +25,7 @@ def detect_merge_conflict(argv=None):
|
|||
parser.add_argument('filenames', nargs='*')
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
if not is_in_merge_conflict():
|
||||
if not is_in_merge():
|
||||
return 0
|
||||
|
||||
retcode = 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue