From 72f991f760aca2486561b7da72493030a54ea288 Mon Sep 17 00:00:00 2001 From: Josip Sokcevic Date: Thu, 23 Apr 2020 18:53:30 +0000 Subject: [PATCH] Fix printing error on git-rebase failure Reverted commit 4511b131e6966f87a8d60e2965df3b65b74d1069 had a bug where squash_ret.success = True and empty_rebase = False. In that case, stdout and stderr would already be string and trying to decode would fail. Bug: 1071280 Change-Id: Iadcc526147ebb98aa7a91a7daa64ef44066e83b6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2163387 Commit-Queue: Edward Lesmes Auto-Submit: Josip Sokcevic Reviewed-by: Edward Lesmes --- git_common.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/git_common.py b/git_common.py index d4f2497f1..182fc0c16 100644 --- a/git_common.py +++ b/git_common.py @@ -662,7 +662,8 @@ def rebase(parent, start, branch, abort=False): except subprocess2.CalledProcessError as cpe: if abort: run_with_retcode('rebase', '--abort') # ignore failure - return RebaseRet(False, cpe.stdout, cpe.stderr) + return RebaseRet(False, cpe.stdout.decode('utf-8', 'replace'), + cpe.stderr.decode('utf-8', 'replace')) def remove_merge_base(branch): @@ -766,7 +767,7 @@ def run_stream_with_retcode(*cmd, **kwargs): retcode = proc.wait() if retcode != 0: raise subprocess2.CalledProcessError(retcode, cmd, os.getcwd(), - None, None) + b'', b'') def run_with_stderr(*cmd, **kwargs):