Skip to content

Commit 1e2a895

Browse files
CopilotByron
andauthored
Handle mypy CI typing failure
Agent-Logs-Url: https://github.com/gitpython-developers/GitPython/sessions/3d3e7ffc-d3af-478e-9c6c-128731cdd102 Co-authored-by: Byron <63622+Byron@users.noreply.github.com>
1 parent 7cdf9c7 commit 1e2a895

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

git/objects/commit.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,14 +463,15 @@ def trailers_list(self) -> List[Tuple[str, str]]:
463463
return trailer_list
464464

465465
@classmethod
466-
def _interpret_trailers(cls, repo: "Repo", message: str, trailer_args: Sequence[str]) -> str:
466+
def _interpret_trailers(cls, repo: "Repo", message: Union[str, bytes], trailer_args: Sequence[str]) -> str:
467467
cmd = [repo.git.GIT_PYTHON_GIT_EXECUTABLE, "interpret-trailers", *trailer_args]
468468
proc: Git.AutoInterrupt = repo.git.execute( # type: ignore[call-overload]
469469
cmd,
470470
as_process=True,
471471
istream=PIPE,
472472
)
473-
stdout_bytes, _ = proc.communicate(message.encode(cls.default_encoding, errors="strict"))
473+
message_bytes = message if isinstance(message, bytes) else message.encode(cls.default_encoding, errors="strict")
474+
stdout_bytes, _ = proc.communicate(message_bytes)
474475
finalize_process(proc)
475476
return stdout_bytes.decode(cls.default_encoding, errors="strict")
476477

0 commit comments

Comments
 (0)