~edwargix/git.sr.ht

0a3366b07aeda88aabfa5166cf0c7db256d4a194 — Drew DeVault 3 years ago 69e2dd1
Fix diffs with invalid UTF-8 paths
1 files changed, 3 insertions(+), 2 deletions(-)

M gitsrht/git.py
M gitsrht/git.py => gitsrht/git.py +3 -2
@@ 53,10 53,11 @@ def get_log(git_repo, commit, path="", commits_per_page=20, until=None):
            _, diff = diff_for_commit(git_repo, commit)
            for patch in diff:
                exact = False
                if patch.delta.new_file.path == path:
                new_path = patch.delta.new_file.raw_path.decode(errors="replace")
                if new_path == path:
                    path = patch.delta.old_file.path
                    exact = True
                if exact or patch.delta.new_file.path.startswith(path + "/"):
                if exact or new_path.startswith(path + "/"):
                    commits.append(commit)
                    break
        else: