summaryrefslogtreecommitdiff
path: root/lib/gitlab/git.rb
diff options
context:
space:
mode:
authorScott Le <scott.lee318@gmail.com>2016-07-28 11:04:57 +0700
committerScott Le <scott.lee318@gmail.com>2016-08-11 23:37:00 +0700
commit6109daf480327581b6e2dcdfffe90464be6c7796 (patch)
tree813f1d607d89c94873ae31633acb9091c8a0e287 /lib/gitlab/git.rb
parent5a33bc984abfb4ee6243c00bbcc71ccd086d2266 (diff)
downloadgitlab-ce-6109daf480327581b6e2dcdfffe90464be6c7796.tar.gz
api for generating new merge request
DRY code + fix rubocop Add more test cases Append to changelog DRY changes list find_url service for merge_requests use GET for getting merge request links remove files rename to get_url_service reduce loop add test case for cross project refactor tiny thing update changelog
Diffstat (limited to 'lib/gitlab/git.rb')
-rw-r--r--lib/gitlab/git.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/gitlab/git.rb b/lib/gitlab/git.rb
index 191bea86ac3..7584efe4fa8 100644
--- a/lib/gitlab/git.rb
+++ b/lib/gitlab/git.rb
@@ -9,6 +9,24 @@ module Gitlab
ref.gsub(/\Arefs\/(tags|heads)\//, '')
end
+ def branch_name(ref)
+ ref = ref.to_s
+ if self.branch_ref?(ref)
+ self.ref_name(ref)
+ else
+ nil
+ end
+ end
+
+ def tag_name(ref)
+ ref = ref.to_s
+ if self.tag_ref?(ref)
+ self.ref_name(ref)
+ else
+ nil
+ end
+ end
+
def tag_ref?(ref)
ref.start_with?(TAG_REF_PREFIX)
end