◐ Shell
reader mode source ↗
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
4 changes: 2 additions & 2 deletions git/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# typing --------------------------------------------------------------------

from typing import Any, AnyStr, Dict, Optional, Type
from git.types import TBD

# ---------------------------------------------------------------------------
Expand All @@ -30,7 +30,7 @@
defenc = sys.getfilesystemencoding()


def safe_decode(s: Optional[AnyStr]) -> Optional[str]:
"""Safely decodes a binary string to unicode"""
if isinstance(s, str):
return s
Expand Down
8 changes: 5 additions & 3 deletions git/exc.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ def __init__(self, command: Union[List[str], Tuple[str, ...], str],
status = "'%s'" % s if isinstance(status, str) else s

self._cmd = safe_decode(command[0])
self._cmdline = ' '.join(str(safe_decode(i)) for i in command)
self._cause = status and " due to: %s" % status or "!"
self.stdout = stdout and "\n stdout: '%s'" % safe_decode(str(stdout)) or ''
self.stderr = stderr and "\n stderr: '%s'" % safe_decode(str(stderr)) or ''

def __str__(self) -> str:
return (self._msg + "\n cmdline: %s%s%s") % (
Expand Down
Toggle all file notes Toggle all file annotations