summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz.bizon@ntsn.pl>2015-12-04 14:11:17 +0100
committerGrzegorz Bizon <grzegorz.bizon@ntsn.pl>2015-12-08 08:43:09 +0100
commit66f658a9b543b1493f625b2f44f3f845d64b749d (patch)
tree7cf86c3ae46fb977a12bc79179472c1bb26d7a6e /lib
parent591035968dc96acd27155ced4c0ae04649fcd113 (diff)
downloadgitlab-ce-66f658a9b543b1493f625b2f44f3f845d64b749d.tar.gz
Check if commits are available in `RepositoryPush`
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/email/message/repository_push.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/gitlab/email/message/repository_push.rb b/lib/gitlab/email/message/repository_push.rb
index ca89b67e580..c53148d2ed8 100644
--- a/lib/gitlab/email/message/repository_push.rb
+++ b/lib/gitlab/email/message/repository_push.rb
@@ -84,8 +84,8 @@ module Gitlab
end
def target_url
- if @action == :push
- if commits.length > 1 && compare
+ if @action == :push && commits
+ if commits.length > 1
@urls.namespace_project_compare_url(project_namespace,
project,
from: Commit.new(compare.base, project),
@@ -116,7 +116,7 @@ module Gitlab
subject_text << "[#{ref_name}]" if @action == :push
subject_text << ' '
- if @action == :push
+ if @action == :push && commits
if commits.length > 1
subject_text << "Deleted " if reverse_compare?
subject_text << "#{commits.length} commits: #{commits.first.title}"