diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-03-21 22:50:18 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-03-21 22:50:18 +0200 |
commit | 5f9d654939d388c7aeb8e84f6bb5b0d65319c535 (patch) | |
tree | c937a5ca3e314d86f6fd7c8ad3e4a4a968b7344f | |
parent | ad5ea14210cc6dcb674c421e296b67ed2d0e6dbc (diff) | |
download | gitlab-ce-5f9d654939d388c7aeb8e84f6bb5b0d65319c535.tar.gz |
Dont show '0 additions and 0 deletions' message for commit
-rw-r--r-- | app/models/commit.rb | 6 | ||||
-rw-r--r-- | app/views/commit/show.html.haml | 11 |
2 files changed, 12 insertions, 5 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index daba5414afa..4d0c57b35fd 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 6a723ee856e..48fb44a99d5 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" |