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

This commit is contained in:
Dmitriy Zaporozhets 2013-03-21 22:50:18 +02:00
parent ad5ea14210
commit 5f9d654939
2 changed files with 12 additions and 5 deletions

View file

@ -172,4 +172,10 @@ class Commit
lines.pop if lines.last == "-- " # end of diff lines.pop if lines.last == "-- " # end of diff
lines.join("\n") lines.join("\n")
end end
def has_zero_stats?
stats.total.zero?
rescue
true
end
end end

View file

@ -1,10 +1,11 @@
= render "commit_box" = render "commit_box"
%p.pull-right.cgray - unless @commit.has_zero_stats?
This commit has %p.pull-right.cgray
%span.cgreen #{@commit.stats.additions} additions This commit has
and %span.cgreen #{@commit.stats.additions} additions
%span.cred #{@commit.stats.deletions} deletions and
%span.cred #{@commit.stats.deletions} deletions
= render "commits/diffs", diffs: @commit.diffs = render "commits/diffs", diffs: @commit.diffs
= render "notes/notes_with_form" = render "notes/notes_with_form"