diff options
author | Yobmod <yobmod@gmail.com> | 2021-08-02 22:26:14 +0100 |
---|---|---|
committer | Yobmod <yobmod@gmail.com> | 2021-08-02 22:26:14 +0100 |
commit | a2a36e06942d7a146d6640f275d4a4ec84e187c0 (patch) | |
tree | c444cc6e44699bfb9e5d4f392855952a00392490 | |
parent | a3f5b1308f3340375832f1f2254b41c1ecbbc17e (diff) | |
download | gitpython-a2a36e06942d7a146d6640f275d4a4ec84e187c0.tar.gz |
Test Dataclass in repo.base.blame() 3
-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 a9d2e5be..0f231e5f 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -890,7 +890,7 @@ class Repo(object): commits: Dict[str, Commit] = {} blames: List[List[Commit | List[str | bytes] | None]] = [] - class InfoTC(TypedDict, total=False): + class InfoTD(TypedDict, total=False): sha: str id: str filename: str @@ -992,19 +992,20 @@ class Repo(object): commits[sha] = c blames[-1][0] = c # END if commit objects needs initial creation - 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) + if not is_binary: + if line_str and line_str[0] == '\t': + line_str = line_str[1:] + line_AnyStr: str | bytes = line_str + else: + line_AnyStr = line_bytes + # 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. + # end handle line contents + if blames[-1][1] is not None: + blames[-1][1].append(line_AnyStr) info.id = sha # END if we collected commit info |