mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-14 14:48:49 +00:00
Fix IndexError when using bitbucket
This commit is contained in:
parent
045c8ae76c
commit
2500b8bbc1
@ -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):
|
||||
assert match(Command('git push', output))
|
||||
assert match(Command('git push master', output))
|
||||
@ -20,6 +33,10 @@ def test_match(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):
|
||||
assert get_new_command(Command('git push', output))\
|
||||
== "git push --set-upstream origin master"
|
||||
|
@ -6,7 +6,7 @@ from thefuck.specific.git import git_support
|
||||
@git_support
|
||||
def match(command):
|
||||
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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user