Skip to content

Commit

Permalink
Skip all newlines from the output of machete-status-branch hook to …
Browse files Browse the repository at this point in the history
…avoid messing up the rendered status
  • Loading branch information
PawelLipski committed Jul 30, 2022
1 parent 1dcad8f commit c835e72
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion git_machete/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}'")
Expand Down

0 comments on commit c835e72

Please sign in to comment.