mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2025-08-16 03:20:21 +08:00
Support rebase conflicts in check-merge-conflicts
This commit is contained in:
@ -15,7 +15,11 @@ WARNING_MSG = 'Merge conflict string "{0}" found in {1}:{2}'
|
|||||||
def is_in_merge():
|
def is_in_merge():
|
||||||
return (
|
return (
|
||||||
os.path.exists(os.path.join('.git', 'MERGE_MSG')) and
|
os.path.exists(os.path.join('.git', 'MERGE_MSG')) and
|
||||||
os.path.exists(os.path.join('.git', 'MERGE_HEAD'))
|
(
|
||||||
|
os.path.exists(os.path.join('.git', 'MERGE_HEAD')) or
|
||||||
|
os.path.exists(os.path.join('.git', 'rebase-apply')) or
|
||||||
|
os.path.exists(os.path.join('.git', 'rebase-merge'))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,6 +54,14 @@ def f1_is_a_conflict_file(tmpdir):
|
|||||||
'=======\n'
|
'=======\n'
|
||||||
'parent\n'
|
'parent\n'
|
||||||
'>>>>>>>'
|
'>>>>>>>'
|
||||||
|
) or f1.startswith(
|
||||||
|
# .gitconfig with [pull] rebase = preserve causes a rebase which
|
||||||
|
# flips parent / child
|
||||||
|
'<<<<<<< HEAD\n'
|
||||||
|
'parent\n'
|
||||||
|
'=======\n'
|
||||||
|
'child\n'
|
||||||
|
'>>>>>>>'
|
||||||
)
|
)
|
||||||
assert os.path.exists(os.path.join('.git', 'MERGE_MSG'))
|
assert os.path.exists(os.path.join('.git', 'MERGE_MSG'))
|
||||||
yield
|
yield
|
||||||
@ -85,7 +93,7 @@ def repository_is_pending_merge(tmpdir):
|
|||||||
repo2_f2.write('child\n')
|
repo2_f2.write('child\n')
|
||||||
cmd_output('git', 'add', '--', repo2_f2.strpath)
|
cmd_output('git', 'add', '--', repo2_f2.strpath)
|
||||||
cmd_output('git', 'commit', '--no-gpg-sign', '-m', 'clone commit2')
|
cmd_output('git', 'commit', '--no-gpg-sign', '-m', 'clone commit2')
|
||||||
cmd_output('git', 'pull', '--no-commit')
|
cmd_output('git', 'pull', '--no-commit', '--no-rebase')
|
||||||
# We should end up in a pending merge
|
# We should end up in a pending merge
|
||||||
assert repo2_f1.read() == 'parent\n'
|
assert repo2_f1.read() == 'parent\n'
|
||||||
assert repo2_f2.read() == 'child\n'
|
assert repo2_f2.read() == 'child\n'
|
||||||
|
Reference in New Issue
Block a user