From e4761ff67ef14df27026bbe9e215b9ddf5e5b3a5 Mon Sep 17 00:00:00 2001 From: Yobmod Date: Mon, 2 Aug 2021 22:45:19 +0100 Subject: Test TypedDict in repo.base.blame() 1 --- git/repo/base.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'git/repo/base.py') diff --git a/git/repo/base.py b/git/repo/base.py index 0a12d959..58b9d5c2 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -909,7 +909,7 @@ class Repo(object): line_str = line_bytes.rstrip().decode(defenc) except UnicodeDecodeError: firstpart = '' - parts = [''] + parts = [] is_binary = True else: # As we don't have an idea when the binary data ends, as it could contain multiple newlines @@ -983,20 +983,21 @@ class Repo(object): info['committer'] + ' ' + info['committer_email']), committed_date=info['committer_date']) commits[sha] = c - blames[-1][0] = c + blames[-1][0] = c # END if commit objects needs initial creation + if not is_binary: + if line_str and line_str[0] == '\t': + line_str = line_str[1:] + else: + pass + # NOTE: We are actually parsing lines out of binary data, which can lead to the + # binary being split up along the newline separator. We will append this to the + # blame we are currently looking at, even though it should be concatenated with + # the last line we have seen. + if blames[-1][1] is not None: - if not is_binary: - if line_str and line_str[0] == '\t': - line_str = line_str[1:] - - blames[-1][1].append(line_str) - else: - # NOTE: We are actually parsing lines out of binary data, which can lead to the - # binary being split up along the newline separator. We will append this to the - # blame we are currently looking at, even though it should be concatenated with - # the last line we have seen. - blames[-1][1].append(line_bytes) + blames[-1][1].append(line_str) + info = {'id': sha} # end handle line contents info = {'id': sha} -- cgit v1.2.1