Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-09-28 13:08:11 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-09-28 13:20:51 +0300
commit76d9e29a65e488a316347e054920924a3c5f8b3d (patch)
treef9c12903e677e19727d5ac135783a06784beb916 /lib/gitlab/git
parent3c2d6b4870afa9cae25007a2ccf90ebf92c37d42 (diff)
Extract git push from merge request refresh service
Diffstat (limited to 'lib/gitlab/git')
-rw-r--r--lib/gitlab/git/push.rb17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/gitlab/git/push.rb b/lib/gitlab/git/push.rb
index d4fe3c623c1..8173af31a0d 100644
--- a/lib/gitlab/git/push.rb
+++ b/lib/gitlab/git/push.rb
@@ -3,10 +3,17 @@
module Gitlab
module Git
class Push
+ attr_reader :oldrev, :newrev
+
def initialize(project, oldrev, newrev, ref)
- @project, @oldrev, @newrev = project, oldrev, newrev
- @repository = project.repository
- @branch_name = Gitlab::Git.ref_name(ref)
+ @project = project
+ @oldrev = oldrev
+ @newrev = newrev
+ @ref = ref
+ end
+
+ def branch_name
+ @branch_name ||= Gitlab::Git.ref_name(@ref)
end
def branch_added?
@@ -20,6 +27,10 @@ module Gitlab
def force_push?
Gitlab::Checks::ForcePush.force_push?(@project, @oldrev, @newrev)
end
+
+ def branch_push?
+ Gitlab::Git.branch_ref?(@ref)
+ end
end
end
end