1
0
mirror of https://github.com/nvbn/thefuck.git synced 2024-10-05 18:31:10 +01:00

#1227: Make git_support support output-independent rules

Fix #1227
This commit is contained in:
Pablo Santiago Blum de Aguiar 2021-08-16 22:44:13 +02:00 committed by Pablo Aguiar
parent 7b7c150bb7
commit 51e4e87280
2 changed files with 4 additions and 3 deletions

View File

@ -27,9 +27,10 @@ def test_git_support(called, command, output):
('ls', False),
('cat git', False),
('cat hub', False)])
def test_git_support_match(command, is_git):
@pytest.mark.parametrize('output', ['', None])
def test_git_support_match(command, is_git, output):
@git_support
def fn(command):
return True
assert fn(Command(command, '')) == is_git
assert fn(Command(command, output)) == is_git

View File

@ -14,7 +14,7 @@ def git_support(fn, command):
return False
# perform git aliases expansion
if 'trace: alias expansion:' in command.output:
if command.output and 'trace: alias expansion:' in command.output:
search = re.search("trace: alias expansion: ([^ ]*) => ([^\n]*)",
command.output)
alias = search.group(1)