mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-22 12:58:33 +00:00
Fix suggestion for git push -u
This was broken by https://github.com/nvbn/thefuck/pull/559
This commit is contained in:
parent
ce6b82c92d
commit
feb36ede5c
@ -23,6 +23,8 @@ def test_match(stderr):
|
|||||||
def test_get_new_command(stderr):
|
def test_get_new_command(stderr):
|
||||||
assert get_new_command(Command('git push', stderr=stderr))\
|
assert get_new_command(Command('git push', stderr=stderr))\
|
||||||
== "git push --set-upstream origin master"
|
== "git push --set-upstream origin master"
|
||||||
|
assert get_new_command(Command('git push -u', stderr=stderr))\
|
||||||
|
== "git push --set-upstream origin master"
|
||||||
assert get_new_command(Command('git push -u origin', stderr=stderr))\
|
assert get_new_command(Command('git push -u origin', stderr=stderr))\
|
||||||
== "git push --set-upstream origin master"
|
== "git push --set-upstream origin master"
|
||||||
assert get_new_command(Command('git push --set-upstream origin', stderr=stderr))\
|
assert get_new_command(Command('git push --set-upstream origin', stderr=stderr))\
|
||||||
|
@ -24,7 +24,11 @@ def get_new_command(command):
|
|||||||
pass
|
pass
|
||||||
if upstream_option_index is not -1:
|
if upstream_option_index is not -1:
|
||||||
command.script_parts.pop(upstream_option_index)
|
command.script_parts.pop(upstream_option_index)
|
||||||
|
try:
|
||||||
command.script_parts.pop(upstream_option_index)
|
command.script_parts.pop(upstream_option_index)
|
||||||
|
except IndexError:
|
||||||
|
# This happens for `git push -u`
|
||||||
|
pass
|
||||||
|
|
||||||
push_upstream = command.stderr.split('\n')[-3].strip().partition('git ')[2]
|
push_upstream = command.stderr.split('\n')[-3].strip().partition('git ')[2]
|
||||||
return replace_argument(" ".join(command.script_parts), 'push', push_upstream)
|
return replace_argument(" ".join(command.script_parts), 'push', push_upstream)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user