1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-14 06:38:32 +00:00

Remove multiple returns

This commit is contained in:
p73632 2019-12-12 11:53:33 +00:00
parent 794cab8842
commit a2cfa53913
2 changed files with 6 additions and 7 deletions

View File

@ -59,7 +59,7 @@ def test_get_branches(branches, branch_list, git_branch):
['git checkout -b unknown']),
(b'',
Command('git commit unknown', did_not_match('unknown')),
'git branch unknown && git commit unknown'),
['git branch unknown && git commit unknown']),
(b' test-random-branch-123',
Command('git checkout tst-rdm-brnch-123',
did_not_match('tst-rdm-brnch-123')),

View File

@ -42,9 +42,8 @@ def get_new_command(command):
if command.script_parts[1] == 'checkout':
new_commands.append(replace_argument(command.script, 'checkout', 'checkout -b'))
if new_commands:
return new_commands
else:
# if neither the better options above match, then resort to this
return shell.and_('git branch {}', '{}').format(
missing_file, command.script)
if not new_commands:
new_commands.append(shell.and_('git branch {}', '{}').format(
missing_file, command.script))
return new_commands