Skip to content

Commit e4761ff

Browse files
committed
Test TypedDict in repo.base.blame() 1
1 parent ed137cb commit e4761ff

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
@@ -909,7 +909,7 @@ class InfoTD(TypedDict, total=False):
909909
line_str = line_bytes.rstrip().decode(defenc)
910910
except UnicodeDecodeError:
911911
firstpart = ''
912-
parts = ['']
912+
parts = []
913913
is_binary = True
914914
else:
915915
# As we don't have an idea when the binary data ends, as it could contain multiple newlines
@@ -983,20 +983,21 @@ class InfoTD(TypedDict, total=False):
983983
info['committer'] + ' ' + info['committer_email']),
984984
committed_date=info['committer_date'])
985985
commits[sha] = c
986-
blames[-1][0] = c
986+
blames[-1][0] = c
987987
# END if commit objects needs initial creation
988+
if not is_binary:
989+
if line_str and line_str[0] == '\t':
990+
line_str = line_str[1:]
991+
else:
992+
pass
993+
# NOTE: We are actually parsing lines out of binary data, which can lead to the
994+
# binary being split up along the newline separator. We will append this to the
995+
# blame we are currently looking at, even though it should be concatenated with
996+
# the last line we have seen.
997+
988998
if blames[-1][1] is not None:
989-
if not is_binary:
990-
if line_str and line_str[0] == '\t':
991-
line_str = line_str[1:]
992-
993-
blames[-1][1].append(line_str)
994-
else:
995-
# NOTE: We are actually parsing lines out of binary data, which can lead to the
996-
# binary being split up along the newline separator. We will append this to the
997-
# blame we are currently looking at, even though it should be concatenated with
998-
# the last line we have seen.
999-
blames[-1][1].append(line_bytes)
999+
blames[-1][1].append(line_str)
1000+
info = {'id': sha}
10001001
# end handle line contents
10011002

10021003
info = {'id': sha}

0 commit comments

Comments
 (0)