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

Appearance settings

Commit 8292032

Browse filesBrowse files
committed
Revert compiling GitCommand shell messages
1 parent d0fb22b commit 8292032
Copy full SHA for 8292032

2 files changed

+8-5Lines changed: 8 additions & 5 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎git/compat.py‎

Copy file name to clipboardExpand all lines: git/compat.py
+2-2Lines 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
Collapse file

‎git/exc.py‎

Copy file name to clipboardExpand all lines: git/exc.py
+6-3Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.