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

Fix IndexError when using bitbucket

This commit is contained in:
David 2018-01-02 22:33:55 +00:00
parent 045c8ae76c
commit 2500b8bbc1
2 changed files with 18 additions and 1 deletions

View File

@ -13,6 +13,19 @@ To push the current branch and set the remote as upstream, use
''' '''
@pytest.fixture
def output_bitbucket():
return '''Total 0 (delta 0), reused 0 (delta 0)
remote:
remote: Create pull request for feature/[...]:
remote: https://bitbucket.org/[...]
remote:
To git@bitbucket.org:[...].git
e5e7fbb..700d998 feature/[...] -> feature/[...]
Branch feature/[...] set up to track remote branch feature/[...] from origin.
'''
def test_match(output): def test_match(output):
assert match(Command('git push', output)) assert match(Command('git push', output))
assert match(Command('git push master', output)) assert match(Command('git push master', output))
@ -20,6 +33,10 @@ def test_match(output):
assert not match(Command('ls', output)) assert not match(Command('ls', output))
def test_match_bitbucket(output_bitbucket):
assert not match(Command('git push origin', output_bitbucket))
def test_get_new_command(output): def test_get_new_command(output):
assert get_new_command(Command('git push', output))\ assert get_new_command(Command('git push', output))\
== "git push --set-upstream origin master" == "git push --set-upstream origin master"

View File

@ -6,7 +6,7 @@ from thefuck.specific.git import git_support
@git_support @git_support
def match(command): def match(command):
return ('push' in command.script return ('push' in command.script
and 'set-upstream' in command.output) and 'git push --set-upstream' in command.output)
def _get_upstream_option_index(command_parts): def _get_upstream_option_index(command_parts):