diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 5958256d2..af239d97f 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -4,6 +4,8 @@ - fixed: git-machete crashing when a local branch uses another local branch as its remote tracking branch (`git config branch.BRANCH.remote` set to `.`) - fixed: fork point incorrectly inferred when a branch has been pushed immediately after being created +- fixed: output of `help` no longer includes ANSI escape codes when stdout is not a terminal +- fixed: all newlines are skipped from the output of `machete-status-branch` hook to avoid messing up the rendered status ## New in git-machete 3.11.3 diff --git a/git_machete/client.py b/git_machete/client.py index 4f05f8a6d..e895497e3 100644 --- a/git_machete/client.py +++ b/git_machete/client.py @@ -1046,7 +1046,8 @@ def print_line_prefix(branch_: LocalBranchShortName, suffix: str) -> None: status_code, stdout, stderr = utils.popen_cmd(hook_path, branch, cwd=self.__git.get_root_dir(), env=hook_env) if status_code == 0: if not stdout.isspace(): - hook_output = f" {stdout.rstrip()}" + # Replace all newlines with spaces, in case the hook prints out more than one line + hook_output = " " + stdout.replace('\n', ' ').rstrip() else: debug("machete-status-branch hook ({hook_path}) for branch {branch} " "returned {status_code}; stdout: '{stdout}'; stderr: '{stderr}'")