| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -87,7 +87,7 @@ def __init__(self, repo: 'Repo', binsha: bytes, tree: 'Tree' = None, | |||
| 87 | 87 | committer: Union[Actor, None] = None, | |
| 88 | 88 | committed_date: Union[int, None] = None, | |
| 89 | 89 | committer_tz_offset: Union[None, float] = None, | |
| 90 | - message: Union[str, None] = None, | ||
| 90 | + message: Union[str, bytes, None] = None, | ||
| 91 | 91 | parents: Union[Sequence['Commit'], None] = None, | |
| 92 | 92 | encoding: Union[str, None] = None, | |
| 93 | 93 | gpgsig: Union[str, None] = None) -> None: | |
@@ -209,9 +209,12 @@ def committed_datetime(self) -> 'datetime.datetime': | |||
| 209 | 209 | return from_timestamp(self.committed_date, self.committer_tz_offset) | |
| 210 | 210 | ||
| 211 | 211 | @property | |
| 212 | - def summary(self) -> str: | ||
| 212 | + def summary(self) -> Union[str, bytes]: | ||
| 213 | 213 | """:return: First line of the commit message""" | |
| 214 | - return self.message.split('\n', 1)[0] | ||
| 214 | + if isinstance(self.message, str): | ||
| 215 | + return self.message.split('\n', 1)[0] | ||
| 216 | + else: | ||
| 217 | + return self.message.split(b'\n', 1)[0] | ||
| 215 | 218 | ||
| 216 | 219 | def count(self, paths: Union[PathLike, Sequence[PathLike]] = '', **kwargs: Any) -> int: | |
| 217 | 220 | """Count the number of commits reachable from this commit | |
@@ -590,12 +593,12 @@ def _deserialize(self, stream: BytesIO) -> 'Commit': | |||
| 590 | 593 | ||
| 591 | 594 | # a stream from our data simply gives us the plain message | |
| 592 | 595 | # The end of our message stream is marked with a newline that we strip | |
| 593 | - self.message_bytes = stream.read() | ||
| 596 | + self.message = stream.read() | ||
| 594 | 597 | try: | |
| 595 | - self.message = self.message_bytes.decode(self.encoding, 'replace') | ||
| 598 | + self.message = self.message.decode(self.encoding, 'replace') | ||
| 596 | 599 | except UnicodeDecodeError: | |
| 597 | 600 | log.error("Failed to decode message '%s' using encoding %s", | |
| 598 | - self.message_bytes, self.encoding, exc_info=True) | ||
| 601 | + self.message, self.encoding, exc_info=True) | ||
| 599 | 602 | # END exception handling | |
| 600 | 603 | ||
| 601 | 604 | return self | |
| Back | FazBrowse Home | New Git URL |
0 commit comments