From 2fa36119361070e2aa3a6780ec4409d48c951bc3 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Tue, 27 Jul 2021 09:27:28 +0200 Subject: [PATCH] Hide large diffs from commit UI Ref ~sircmpwn/git.sr.ht#346 --- gitsrht/templates/utils.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gitsrht/templates/utils.html b/gitsrht/templates/utils.html index da31c45..a700b55 100644 --- a/gitsrht/templates/utils.html +++ b/gitsrht/templates/utils.html @@ -157,6 +157,17 @@ endif %}{% endfor %} {% macro commit_diff(repo, commit, diff, anchor="", target_blank=False) %} {# God, working with
 tags is such a fucking mess #}
+{% if diff.stats.insertions + diff.stats.deletions > 10000 %}
+
+This diff is too large to display. Try viewing the raw diff +instead. +
+{% else %} {% for patch in diff %}
{#
@@ -231,4 +242,5 @@ endif %}{% endfor %}
 {% endfor %}
{% endif %} {% endfor %} +{% endif %} {% endmacro %} -- 2.38.4