diff --git a/app/models/commit.rb b/app/models/commit.rb index daba541..4d0c57b 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -172,4 +172,10 @@ class Commit lines.pop if lines.last == "-- " # end of diff lines.join("\n") end + + def has_zero_stats? + stats.total.zero? + rescue + true + end end diff --git a/app/views/commit/show.html.haml b/app/views/commit/show.html.haml index 6a723ee..48fb44a 100644 --- a/app/views/commit/show.html.haml +++ b/app/views/commit/show.html.haml @@ -1,10 +1,11 @@ = render "commit_box" -%p.pull-right.cgray - This commit has - %span.cgreen #{@commit.stats.additions} additions - and - %span.cred #{@commit.stats.deletions} deletions +- unless @commit.has_zero_stats? + %p.pull-right.cgray + This commit has + %span.cgreen #{@commit.stats.additions} additions + and + %span.cred #{@commit.stats.deletions} deletions = render "commits/diffs", diffs: @commit.diffs = render "notes/notes_with_form" -- libgit2 0.21.2