From 0a3366b07aeda88aabfa5166cf0c7db256d4a194 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 27 Sep 2021 12:43:30 +0200 Subject: [PATCH] Fix diffs with invalid UTF-8 paths --- gitsrht/git.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gitsrht/git.py b/gitsrht/git.py index 9caf8c5..2daf611 100644 --- a/gitsrht/git.py +++ b/gitsrht/git.py @@ -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: -- 2.38.4