diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-03-10 13:51:36 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-03-10 15:39:31 +0300 |
commit | 383c56efa1882d9cab956de5b5b72e51691c3f0c (patch) | |
tree | 1eebe2c35351d44a9fa54f53658346f86d9566a3 /lib/gitlab/git.rb | |
parent | e0caed91e2cd6b959f808139df7c40f3644f88fd (diff) |
Use Gitlab::Git helper methods and constants as much as possible.
Diffstat (limited to 'lib/gitlab/git.rb')
-rw-r--r-- | lib/gitlab/git.rb | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/gitlab/git.rb b/lib/gitlab/git.rb index 4a712c6345f..0c350d7c675 100644 --- a/lib/gitlab/git.rb +++ b/lib/gitlab/git.rb @@ -1,9 +1,25 @@ module Gitlab module Git BLANK_SHA = '0' * 40 + TAG_REF_PREFIX = "refs/tags/" + BRANCH_REF_PREFIX = "refs/heads/" - def self.extract_ref_name(ref) - ref.gsub(/\Arefs\/(tags|heads)\//, '') + class << self + def ref_name(ref) + ref.gsub(/\Arefs\/(tags|heads)\//, '') + end + + def tag_ref?(ref) + ref.start_with?(TAG_REF_PREFIX) + end + + def branch_ref?(ref) + ref.start_with?(BRANCH_REF_PREFIX) + end + + def blank_ref?(ref) + ref == BLANK_SHA + end end end end |