Commit 5f9d654939d388c7aeb8e84f6bb5b0d65319c535

Authored by Dmitriy Zaporozhets
1 parent ad5ea142

Dont show '0 additions and 0 deletions' message for commit

app/models/commit.rb
... ... @@ -172,4 +172,10 @@ class Commit
172 172 lines.pop if lines.last == "-- " # end of diff
173 173 lines.join("\n")
174 174 end
  175 +
  176 + def has_zero_stats?
  177 + stats.total.zero?
  178 + rescue
  179 + true
  180 + end
175 181 end
... ...
app/views/commit/show.html.haml
1 1 = render "commit_box"
2 2  
3   -%p.pull-right.cgray
4   - This commit has
5   - %span.cgreen #{@commit.stats.additions} additions
6   - and
7   - %span.cred #{@commit.stats.deletions} deletions
  3 +- unless @commit.has_zero_stats?
  4 + %p.pull-right.cgray
  5 + This commit has
  6 + %span.cgreen #{@commit.stats.additions} additions
  7 + and
  8 + %span.cred #{@commit.stats.deletions} deletions
8 9  
9 10 = render "commits/diffs", diffs: @commit.diffs
10 11 = render "notes/notes_with_form"
... ...