[FIX] forwardport: avoid logging git error if there's no stream data

If no stream data was captured (no stderr and no stdout), would just
log

    git call error:

as error, with no further information.

Don't do that if we have neither stderr nor stdout data, since we're
re-raising the exception anyway, it's just confusing.
This commit is contained in:
Xavier Morel 2022-10-25 11:51:51 +02:00
parent 22c3406659
commit 13f239826e

View File

@ -1146,8 +1146,9 @@ class Repo:
try:
return self._opener(args, **opts)
except subprocess.CalledProcessError as e:
stream = e.stderr if e.stderr else e.stdout if e.stdout else ''
_logger.error("git call error%s%s", stream and ': ', stream)
stream = e.stderr if e.stderr else e.stdout
if stream:
_logger.error("git call error: %s", stream)
raise
def stdout(self, flag=True):