Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3211ae9

Browse files
jmcgill298Byron
authored andcommitted
Revert compiling GitCommand shell messages
1 parent d0fb22b commit 3211ae9

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-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: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,12 @@ 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+
self._cmdline = ' '.join(safe_decode(i) for i in command)
6969
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 ''
70+
stdout_decode = safe_decode(stdout)
71+
stderr_decode = safe_decode(stderr)
72+
self.stdout = stdout_decode and "\n stdout: '%s'" % stdout_decode or ''
73+
self.stderr = stderr_decode and "\n stderr: '%s'" % stderr_decode or ''
7274

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

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /