home » zplus/clif.git
Author zPlus <zplus@peers.community> 2022-08-09 09:14:54
Committer zPlus <zplus@peers.community> 2022-08-09 09:14:54
Commit 0511461 (patch)
Tree 5802694
Parent(s)

Fix division by zero error in diffstat histogram. Do not compute histogram when there are a total of zero insertions and deletions.


commits diff: 0b2642a..0511461
1 file changed, 4 insertions, 2 deletionsdownload


Diffstat
-rw-r--r-- templates/repository/commit.html 6

Diff options
View
Side
Whitespace
Context lines
Inter-hunk lines
+4/-2 M   templates/repository/commit.html
index 6f3d68e..4d15658
old size: 17K - new size: 17K
@@ -74,8 +74,10 @@
74 74 <td class="path">{{ patch.delta.new_file.path }}</td>
75 75 <td class="lines">{{ patch.line_stats[1] + patch.line_stats[2] }}</td>
76 76 <td class="histogram">
77 - <span title="+{{ patch.line_stats[1] }}" class="insertions" style="width:{{ patch.line_stats[1] / (diff_stats.insertions + diff_stats.deletions) * 100 }}%"></span
78 - ><span title="-{{ patch.line_stats[2] }}" class="deletions" style="width:{{ patch.line_stats[2] / (diff_stats.insertions + diff_stats.deletions) * 100 }}%"></span>
77 + {% if diff_stats.insertions + diff_stats.deletions > 0 %}
78 + <span title="+{{ patch.line_stats[1] }}" class="insertions" style="width:{{ patch.line_stats[1] / (diff_stats.insertions + diff_stats.deletions) * 100 }}%"></span
79 + ><span title="-{{ patch.line_stats[2] }}" class="deletions" style="width:{{ patch.line_stats[2] / (diff_stats.insertions + diff_stats.deletions) * 100 }}%"></span>
80 + {% endif %}
79 81 </td>
80 82 <td></td>
81 83 </tr>