Skip to content
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 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 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
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