From aa8d46aa64a9feb5dc677c78b1225c52aff5bd6f Mon Sep 17 00:00:00 2001 From: zPlus Date: Fri, 5 Aug 2022 07:31:37 +0200 Subject: [PATCH] Log page: show diffstat for first commit. --- web.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web.py b/web.py index 4386480..772b5eb 100644 --- a/web.py +++ b/web.py @@ -506,8 +506,11 @@ def log(repository, revision): commits.append(commit) - if len(commit.parents) > 0: - diff[commit.short_id] = commit.parents[0].tree.diff_to_tree(commit.tree) + # Diff with parent tree, or empty tree if there's no parent + diff[commit.short_id] = \ + commit.parents[0].tree.diff_to_tree(commit.tree) \ + if len(commit.parents) > 0 \ + else commit.tree.diff_to_tree(swap=True) return template( 'repository/log.html',