mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-31 10:11:14 +00:00
Merge pull request #538 from lukechilds/git-push-with-args
Preserve args for git_push
This commit is contained in:
commit
4d65d6a1df
@ -14,6 +14,7 @@ To push the current branch and set the remote as upstream, use
|
||||
|
||||
|
||||
def test_match(stderr):
|
||||
assert match(Command('git push', stderr=stderr))
|
||||
assert match(Command('git push master', stderr=stderr))
|
||||
assert not match(Command('git push master'))
|
||||
assert not match(Command('ls', stderr=stderr))
|
||||
@ -22,3 +23,5 @@ def test_match(stderr):
|
||||
def test_get_new_command(stderr):
|
||||
assert get_new_command(Command('git push', stderr=stderr))\
|
||||
== "git push --set-upstream origin master"
|
||||
assert get_new_command(Command('git push --quiet', stderr=stderr))\
|
||||
== "git push --set-upstream origin master --quiet"
|
||||
|
@ -1,3 +1,4 @@
|
||||
from thefuck.utils import replace_argument
|
||||
from thefuck.specific.git import git_support
|
||||
|
||||
|
||||
@ -9,4 +10,5 @@ def match(command):
|
||||
|
||||
@git_support
|
||||
def get_new_command(command):
|
||||
return command.stderr.split('\n')[-3].strip()
|
||||
push_upstream = command.stderr.split('\n')[-3].strip().partition('git ')[2]
|
||||
return replace_argument(command.script, 'push', push_upstream)
|
||||
|
Loading…
x
Reference in New Issue
Block a user