diff --git a/tests/rules/test_git_push.py b/tests/rules/test_git_push.py index 785b08ee..5a778fd0 100644 --- a/tests/rules/test_git_push.py +++ b/tests/rules/test_git_push.py @@ -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" diff --git a/thefuck/rules/git_push.py b/thefuck/rules/git_push.py index e11938ba..fbf5567b 100644 --- a/thefuck/rules/git_push.py +++ b/thefuck/rules/git_push.py @@ -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):