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
path: root/lib
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-03-19 18:53:43 +0300
committerDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-03-19 18:53:43 +0300
commitc8a7e4c6c1406973b532d184e05f72e32f607326 (patch)
tree3403a7e6b1ced5331a43b549bd46f686a36cc157 /lib
parentc71fa13206d2eaac0324c842190b184249ed5e64 (diff)
parenta5a5ec970e0e8dc56103decd3a0f5fbf3db46bcb (diff)
Merge branch 'fewer-constants-more-helpres' into 'master'
Fewer Git constants, more Git helpers. See merge request !1727
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/force_push_check.rb7
-rw-r--r--lib/gitlab/push_data_builder.rb3
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/gitlab/force_push_check.rb b/lib/gitlab/force_push_check.rb
index eae9773a067..fdb6a35c78d 100644
--- a/lib/gitlab/force_push_check.rb
+++ b/lib/gitlab/force_push_check.rb
@@ -3,11 +3,12 @@ module Gitlab
def self.force_push?(project, oldrev, newrev)
return false if project.empty_repo?
- if oldrev != Gitlab::Git::BLANK_SHA && newrev != Gitlab::Git::BLANK_SHA
+ # Created or deleted branch
+ if Gitlab::Git.blank_ref?(oldrev) || Gitlab::Git.blank_ref?(newrev)
+ false
+ else
missed_refs, _ = Gitlab::Popen.popen(%W(git --git-dir=#{project.repository.path_to_repo} rev-list #{oldrev} ^#{newrev}))
missed_refs.split("\n").size > 0
- else
- false
end
end
end
diff --git a/lib/gitlab/push_data_builder.rb b/lib/gitlab/push_data_builder.rb
index 694a30db5df..948cf58fd9a 100644
--- a/lib/gitlab/push_data_builder.rb
+++ b/lib/gitlab/push_data_builder.rb
@@ -71,7 +71,8 @@ module Gitlab
end
def checkout_sha(repository, newrev, ref)
- if newrev != Gitlab::Git::BLANK_SHA && Gitlab::Git.tag_ref?(ref)
+ # Find sha for tag, except when it was deleted.
+ if Gitlab::Git.tag_ref?(ref) && !Gitlab::Git.blank_ref?(newrev)
tag_name = Gitlab::Git.ref_name(ref)
tag = repository.find_tag(tag_name)