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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 4 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 typing import IO, Any, AnyStr, Dict, Optional, Type, Union
from git.types import TBD

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


def safe_decode(s: Optional[AnyStr]) -> Optional[str]:
def safe_decode(s: Union[IO[str], AnyStr, None]) -> Optional[str]:
"""Safely decodes a binary string to unicode"""
if isinstance(s, str):
return s
Expand Down
8 changes: 5 additions & 3 deletions 8 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._cmdline = ' '.join(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 ''
stdout_decode = safe_decode(stdout)
stderr_decode = safe_decode(stderr)
self.stdout = stdout_decode and "\n stdout: '%s'" % stdout_decode or ''
self.stderr = stderr_decode and "\n stderr: '%s'" % stderr_decode or ''

def __str__(self) -> str:
return (self._msg + "\n cmdline: %s%s%s") % (
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.