1
0
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:
Vladimir Iakovlev 2016-08-21 15:20:54 +08:00 committed by GitHub
commit 4d65d6a1df
2 changed files with 6 additions and 1 deletions

View File

@ -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"

View File

@ -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)