From 8a54a7eac38070abf948524805b11e91471de401 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 19 Aug 2022 02:16:19 -0400 Subject: [PATCH] cherry-pick: tighten up output If stdout or stderr are empty, don't print empty lines. Also trim any trailing lines so we don't show excess ones. Change-Id: I65fcea191e1f725be03c064cb510578632466013 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/343516 Tested-by: Mike Frysinger Reviewed-by: LaMont Jones --- subcmds/cherry_pick.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/subcmds/cherry_pick.py b/subcmds/cherry_pick.py index 7bd858bf..eecf4e17 100644 --- a/subcmds/cherry_pick.py +++ b/subcmds/cherry_pick.py @@ -60,8 +60,10 @@ change id will be added. capture_stderr=True) status = p.Wait() - print(p.stdout, file=sys.stdout) - print(p.stderr, file=sys.stderr) + if p.stdout: + print(p.stdout.strip(), file=sys.stdout) + if p.stderr: + print(p.stderr.strip(), file=sys.stderr) if status == 0: # The cherry-pick was applied correctly. We just need to edit the