From cef9ed92d7933ee21b9fb47ce0ab3af5717184bb Mon Sep 17 00:00:00 2001 From: v4rgas <66626747+v4rgas@users.noreply.github.com> Date: Thu, 15 May 2025 17:38:11 -0400 Subject: [PATCH 1/2] d67b079d-5fc0-4dcd-8689-2b74a630c15b --- thefuck_9/tests/rules/test_git_push.py | 2 -- thefuck_9/thefuck/rules/git_push.py | 6 +----- 2 files changed, 1 insertion(+), 7 deletions(-) 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) From ce09eeaf44c6769b3b312de842aa721040e39070 Mon Sep 17 00:00:00 2001 From: v4rgas <66626747+v4rgas@users.noreply.github.com> Date: Thu, 15 May 2025 18:03:59 -0400 Subject: [PATCH 2/2] Update test cases for 'thefuck' issues in README --- readme.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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