diff --git a/readme.md b/readme.md index 22b204b..01cd53d 100644 --- a/readme.md +++ b/readme.md @@ -76,4 +76,11 @@ Each test case below corresponds to a buggy-to-fixed repository pair. - https://github.com/nvbn/thefuck/issues/807 - thefuck_5 - Related issues: - - https://github.com/nvbn/thefuck/issues/723 \ No newline at end of file + - https://github.com/nvbn/thefuck/issues/723 +- thefuck_7 + - Related issues: + - Not available +- thefuck_9 + - Related issues: + - https://github.com/nvbn/thefuck/pull/559 + - https://github.com/nvbn/thefuck/issues/558 \ No newline at end of file diff --git a/thefuck_9/tests/rules/test_git_push.py b/thefuck_9/tests/rules/test_git_push.py index 1eb61b2..d665496 100644 --- a/thefuck_9/tests/rules/test_git_push.py +++ b/thefuck_9/tests/rules/test_git_push.py @@ -23,8 +23,6 @@ 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 -u', stderr=stderr))\ - == "git push --set-upstream origin master" assert get_new_command(Command('git push -u origin', stderr=stderr))\ == "git push --set-upstream origin master" assert get_new_command(Command('git push --set-upstream origin', stderr=stderr))\ diff --git a/thefuck_9/thefuck/rules/git_push.py b/thefuck_9/thefuck/rules/git_push.py index f64d2ce..0a624eb 100644 --- a/thefuck_9/thefuck/rules/git_push.py +++ b/thefuck_9/thefuck/rules/git_push.py @@ -24,11 +24,7 @@ def get_new_command(command): pass if upstream_option_index is not -1: command.script_parts.pop(upstream_option_index) - try: - command.script_parts.pop(upstream_option_index) - except IndexError: - # This happens for `git push -u` - pass + command.script_parts.pop(upstream_option_index) push_upstream = command.stderr.split('\n')[-3].strip().partition('git ')[2] return replace_argument(" ".join(command.script_parts), 'push', push_upstream)