diff options
-rw-r--r-- | app/models/ci/commit.rb | 2 | ||||
-rw-r--r-- | app/services/create_commit_builds_service.rb | 6 | ||||
-rw-r--r-- | lib/ci/git.rb | 5 |
3 files changed, 4 insertions, 9 deletions
diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb index 79193344545..d2a29236942 100644 --- a/app/models/ci/commit.rb +++ b/app/models/ci/commit.rb @@ -53,7 +53,7 @@ module Ci end def valid_commit_sha - if self.sha == Ci::Git::BLANK_SHA + if self.sha == Gitlab::Git::BLANK_SHA self.errors.add(:sha, " cant be 00000000 (branch removal)") end end diff --git a/app/services/create_commit_builds_service.rb b/app/services/create_commit_builds_service.rb index 392fe21eecf..759c334ebe9 100644 --- a/app/services/create_commit_builds_service.rb +++ b/app/services/create_commit_builds_service.rb @@ -9,14 +9,14 @@ class CreateCommitBuildsService return false end - ref = origin_ref.gsub(/\Arefs\/(tags|heads)\//, '') + ref = Gitlab::Git.ref_name(origin_ref) # Skip branch removal - if sha == Ci::Git::BLANK_SHA + if sha == Gitlab::Git::BLANK_SHA return false end - tag = origin_ref.start_with?('refs/tags/') + tag = Gitlab::Git.tag_ref?(origin_ref) commit = project.ensure_ci_commit(sha) unless commit.skip_ci? commit.update_committed! diff --git a/lib/ci/git.rb b/lib/ci/git.rb deleted file mode 100644 index 7acc3f38edb..00000000000 --- a/lib/ci/git.rb +++ /dev/null @@ -1,5 +0,0 @@ -module Ci - module Git - BLANK_SHA = '0' * 40 - end -end |