Skip to content
Browse files

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

  • Loading branch information...
1 parent ad5ea14 commit 5f9d654939d388c7aeb8e84f6bb5b0d65319c535 @randx randx committed
Showing with 12 additions and 5 deletions.
  1. +6 −0 app/models/commit.rb
  2. +6 −5 app/views/commit/show.html.haml
View
6 app/models/commit.rb
@@ -172,4 +172,10 @@ def to_diff
lines.pop if lines.last == "-- " # end of diff
lines.join("\n")
end
+
+ def has_zero_stats?
+ stats.total.zero?
+ rescue
+ true
+ end
end
View
11 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"

0 comments on commit 5f9d654

Please sign in to comment.
Something went wrong with that request. Please try again.