Skip to content

Commit 8292032

Browse files
committed
Revert compiling GitCommand shell messages
1 parent d0fb22b commit 8292032

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

git/compat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
# typing --------------------------------------------------------------------
2020

21-
from typing import Any, AnyStr, Dict, Optional, Type
21+
from typing import IO, Any, AnyStr, Dict, Optional, Type, Union
2222
from git.types import TBD
2323

2424
# ---------------------------------------------------------------------------
@@ -30,7 +30,7 @@
3030
defenc = sys.getfilesystemencoding()
3131

3232

33-
def safe_decode(s: Optional[AnyStr]) -> Optional[str]:
33+
def safe_decode(s: Union[IO[str], AnyStr, None]) -> Optional[str]:
3434
"""Safely decodes a binary string to unicode"""
3535
if isinstance(s, str):
3636
return s

git/exc.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,13 @@ def __init__(self, command: Union[List[str], Tuple[str, ...], str],
6565
status = "'%s'" % s if isinstance(status, str) else s
6666

6767
self._cmd = safe_decode(command[0])
68-
self._cmdline = ' '.join(str(safe_decode(i)) for i in command)
68+
command_decode = [safe_decode(i) for i in command]
69+
self._cmdline = ' '.join(safe_decode(i) for i in command_decode)
6970
self._cause = status and " due to: %s" % status or "!"
70-
self.stdout = stdout and "\n stdout: '%s'" % safe_decode(str(stdout)) or ''
71-
self.stderr = stderr and "\n stderr: '%s'" % safe_decode(str(stderr)) or ''
71+
stdout_decode = safe_decode(stdout)
72+
stderr_decode = safe_decode(stderr)
73+
self.stdout = stdout_decode and "\n stdout: '%s'" % stdout_decode or ''
74+
self.stderr = stderr_decode and "\n stderr: '%s'" % stderr_decode or ''
7275

7376
def __str__(self) -> str:
7477
return (self._msg + "\n cmdline: %s%s%s") % (

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy