1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-19 17:18:42 +00:00

git_checkout: Use script_parts instead of script.startswith

This lets it work even if there's extra spaces in the command, e.g.

    git  checkout unknown
This commit is contained in:
Joseph Frazier 2018-01-01 18:19:24 -05:00
parent 5bef2c60c5
commit e2ea2e14fa

View File

@ -34,7 +34,7 @@ def get_new_command(command):
fallback_to_first=False) fallback_to_first=False)
if closest_branch: if closest_branch:
return replace_argument(command.script, missing_file, closest_branch) return replace_argument(command.script, missing_file, closest_branch)
elif command.script.startswith('git checkout'): elif command.script_parts[1] == 'checkout':
return replace_argument(command.script, 'checkout', 'checkout -b') return replace_argument(command.script, 'checkout', 'checkout -b')
else: else:
return shell.and_('git branch {}', '{}').format( return shell.and_('git branch {}', '{}').format(