diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 55654c896..af8f14881 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -2,6 +2,8 @@ ## New in git-machete 3.31.1 +- fixed: AUR package installation (reported by @jan-san) + ## New in git-machete 3.31.0 - added: `git machete git{hub,lab} update-{pr,mr}-descriptions` subcommands diff --git a/git_machete/utils.py b/git_machete/utils.py index fcc968f57..84546a81d 100644 --- a/git_machete/utils.py +++ b/git_machete/utils.py @@ -254,9 +254,7 @@ def redact_tokens(input: str) -> str: def get_cmd_shell_repr(cmd: str, *args: str, env: Optional[Dict[str, str]]) -> str: def shell_escape(arg: str) -> str: - return arg.replace("(", "\\(") \ - .replace(")", "\\)") \ - .replace(" ", "\\ ") \ + return re.sub("[() <>$]", r"\\\g<0>", arg) \ .replace("\t", "$'\\t'") \ .replace("\n", "$'\\n'") diff --git a/tests/test_edit.py b/tests/test_edit.py index 873ebb30f..2df2bfc55 100644 --- a/tests/test_edit.py +++ b/tests/test_edit.py @@ -44,8 +44,9 @@ def test_edit_git_editor(self) -> None: ) assert self.repo_sandbox.read_file(".git/machete").strip() == "foo" - def test_edit_git_config_core_editor(self) -> None: + def test_edit_editor(self) -> None: self.repo_sandbox.set_git_config_key("advice.macheteEditorSelection", "false") + self.repo_sandbox.set_git_config_key("core.editor", "lolxd-this-doesnt-exist") with overridden_environment(GIT_MACHETE_EDITOR=" ", GIT_EDITOR="lolxd-this-doesnt-exist", VISUAL="", EDITOR=dummy_editor): assert_success(["edit"], "") @@ -53,6 +54,7 @@ def test_edit_git_config_core_editor(self) -> None: def test_edit_no_variant_matches(self, mocker: MockerFixture) -> None: self.patch_symbol(mocker, "git_machete.utils.find_executable", lambda _executable: None) + self.repo_sandbox.set_git_config_key("core.editor", "lolxd-this-doesnt-exist") with overridden_environment(GIT_MACHETE_EDITOR=" ", GIT_EDITOR="lolxd-this-doesnt-exist", VISUAL="", EDITOR=""): assert_failure(