Allow multiple returns from git_checkout (#1022)
* Allow multiple returns from git_checkout * Remove multiple returns
This commit is contained in:
committed by
Vladimir Iakovlev
parent
b28ece0f34
commit
2ced7a7f33
@@ -34,10 +34,16 @@ def get_new_command(command):
|
||||
r"did not match any file\(s\) known to git", command.output)[0]
|
||||
closest_branch = utils.get_closest(missing_file, get_branches(),
|
||||
fallback_to_first=False)
|
||||
|
||||
new_commands = []
|
||||
|
||||
if closest_branch:
|
||||
return replace_argument(command.script, missing_file, closest_branch)
|
||||
elif command.script_parts[1] == 'checkout':
|
||||
return replace_argument(command.script, 'checkout', 'checkout -b')
|
||||
else:
|
||||
return shell.and_('git branch {}', '{}').format(
|
||||
missing_file, command.script)
|
||||
new_commands.append(replace_argument(command.script, missing_file, closest_branch))
|
||||
if command.script_parts[1] == 'checkout':
|
||||
new_commands.append(replace_argument(command.script, 'checkout', 'checkout -b'))
|
||||
|
||||
if not new_commands:
|
||||
new_commands.append(shell.and_('git branch {}', '{}').format(
|
||||
missing_file, command.script))
|
||||
|
||||
return new_commands
|
||||
|
||||
Reference in New Issue
Block a user