1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-01-20 21:04:32 +00:00
thefuck/tests/rules/test_git_merge_unrelated.py
Joseph Frazier 027b41da59
Add git_merge_unrelated rule for git merge --allow-unrelated-histories (#773)
From https://git-scm.com/docs/merge-options#merge-options---allow-unrelated-histories

> By default, `git merge` command refuses to merge histories that do not
share a common ancestor. This option can be used to override this safety
when merging histories of two projects that started their lives
independently.
2018-01-16 20:03:56 -05:00

26 lines
876 B
Python

import pytest
from thefuck.rules.git_merge_unrelated import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def output():
return 'fatal: refusing to merge unrelated histories'
def test_match(output):
assert match(Command('git merge test', output))
assert not match(Command('git merge master', ''))
assert not match(Command('ls', output))
@pytest.mark.parametrize('command, new_command', [
(Command('git merge local', output()),
'git merge local --allow-unrelated-histories'),
(Command('git merge -m "test" local', output()),
'git merge -m "test" local --allow-unrelated-histories'),
(Command('git merge -m "test local" local', output()),
'git merge -m "test local" local --allow-unrelated-histories')])
def test_get_new_command(command, new_command):
assert get_new_command(command) == new_command