diff options
| author | Yobmod <yobmod@gmail.com> | 2021-08-02 22:45:19 +0100 | 
|---|---|---|
| committer | Yobmod <yobmod@gmail.com> | 2021-08-02 22:45:19 +0100 | 
| commit | e4761ff67ef14df27026bbe9e215b9ddf5e5b3a5 (patch) | |
| tree | 6976682cb3c30fa91901b9eb8a31fa5a181b7920 /git/repo/base.py | |
| parent | ed137cbddf69ae11e5287a9e96e1df1a6e71250d (diff) | |
| download | gitpython-e4761ff67ef14df27026bbe9e215b9ddf5e5b3a5.tar.gz | |
Test TypedDict in repo.base.blame() 1
Diffstat (limited to 'git/repo/base.py')
| -rw-r--r-- | git/repo/base.py | 27 | 
1 files changed, 14 insertions, 13 deletions
| 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} | 
