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 15:46:22 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-09-28 15:46:22 +0300
commit4abba28944803d9a818925e62211a0f65458e011 (patch)
tree8ef280e3b6e0ee7263473fc05ceb11d186efb2d4 /lib/gitlab/git
parent76d9e29a65e488a316347e054920924a3c5f8b3d (diff)
Add specs for extracted git push class
Diffstat (limited to 'lib/gitlab/git')
-rw-r--r--lib/gitlab/git/push.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/gitlab/git/push.rb b/lib/gitlab/git/push.rb
index 8173af31a0d..b6e414927ea 100644
--- a/lib/gitlab/git/push.rb
+++ b/lib/gitlab/git/push.rb
@@ -3,6 +3,8 @@
module Gitlab
module Git
class Push
+ include Gitlab::Utils::StrongMemoize
+
attr_reader :oldrev, :newrev
def initialize(project, oldrev, newrev, ref)
@@ -13,7 +15,9 @@ module Gitlab
end
def branch_name
- @branch_name ||= Gitlab::Git.ref_name(@ref)
+ strong_memoize(:branch_name) do
+ Gitlab::Git.branch_name(@ref)
+ end
end
def branch_added?
@@ -29,7 +33,9 @@ module Gitlab
end
def branch_push?
- Gitlab::Git.branch_ref?(@ref)
+ strong_memoize(:branch_push) do
+ Gitlab::Git.branch_ref?(@ref)
+ end
end
end
end