Skip to content

Commit a2a36e0

Browse files
committed
Test Dataclass in repo.base.blame() 3
1 parent a3f5b13 commit a2a36e0

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

git/repo/base.py

+14-13
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ def blame(self, rev: Union[str, HEAD], file: str, incremental: bool = False, **k
890890
commits: Dict[str, Commit] = {}
891891
blames: List[List[Commit | List[str | bytes] | None]] = []
892892

893-
class InfoTC(TypedDict, total=False):
893+
class InfoTD(TypedDict, total=False):
894894
sha: str
895895
id: str
896896
filename: str
@@ -992,19 +992,20 @@ class InfoDC(Dict[str, Union[str, int]]):
992992
commits[sha] = c
993993
blames[-1][0] = c
994994
# END if commit objects needs initial creation
995-
if blames[-1][1] is not None:
996-
if not is_binary:
997-
if line_str and line_str[0] == '\t':
998-
line_str = line_str[1:]
999-
1000-
blames[-1][1].append(line_str)
1001-
else:
1002-
# NOTE: We are actually parsing lines out of binary data, which can lead to the
1003-
# binary being split up along the newline separator. We will append this to the
1004-
# blame we are currently looking at, even though it should be concatenated with
1005-
# the last line we have seen.
1006-
blames[-1][1].append(line_bytes)
995+
if not is_binary:
996+
if line_str and line_str[0] == '\t':
997+
line_str = line_str[1:]
998+
line_AnyStr: str | bytes = line_str
999+
else:
1000+
line_AnyStr = line_bytes
1001+
# NOTE: We are actually parsing lines out of binary data, which can lead to the
1002+
# binary being split up along the newline separator. We will append this to the
1003+
# blame we are currently looking at, even though it should be concatenated with
1004+
# the last line we have seen.
1005+
10071006
# end handle line contents
1007+
if blames[-1][1] is not None:
1008+
blames[-1][1].append(line_AnyStr)
10081009

10091010
info.id = sha
10101011
# END if we collected commit info

0 commit comments

Comments
 (0)