summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-12-02 17:42:56 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-12-02 17:42:56 +0200
commit835cbc06d8d9c773a3b405eca81650378a8ccdcd (patch)
treef9f99c08e4cab4fbaf25448ed4adc3f3cfe42908 /lib
parent9211b541d3eaa60401f4ab6a5d264f9179ad4160 (diff)
downloadgitlab-ce-835cbc06d8d9c773a3b405eca81650378a8ccdcd.tar.gz
Reload mr code on force push too
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/force_push_check.rb15
-rw-r--r--lib/gitlab/git_access.rb9
2 files changed, 16 insertions, 8 deletions
diff --git a/lib/gitlab/force_push_check.rb b/lib/gitlab/force_push_check.rb
new file mode 100644
index 00000000000..6a52cdba608
--- /dev/null
+++ b/lib/gitlab/force_push_check.rb
@@ -0,0 +1,15 @@
+module Gitlab
+ class ForcePushCheck
+ def self.force_push?(project, oldrev, newrev)
+ return false if project.empty_repo?
+
+ if oldrev != Gitlab::Git::BLANK_SHA && newrev != Gitlab::Git::BLANK_SHA
+ missed_refs = IO.popen(%W(git --git-dir=#{project.repository.path_to_repo} rev-list #{oldrev} ^#{newrev})).read
+ missed_refs.split("\n").size > 0
+ else
+ false
+ end
+ end
+ end
+end
+
diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb
index 5f8cb19efdf..8b4729896b5 100644
--- a/lib/gitlab/git_access.rb
+++ b/lib/gitlab/git_access.rb
@@ -94,14 +94,7 @@ module Gitlab
end
def forced_push?(project, oldrev, newrev)
- return false if project.empty_repo?
-
- if oldrev != Gitlab::Git::BLANK_SHA && newrev != Gitlab::Git::BLANK_SHA
- missed_refs = IO.popen(%W(git --git-dir=#{project.repository.path_to_repo} rev-list #{oldrev} ^#{newrev})).read
- missed_refs.split("\n").size > 0
- else
- false
- end
+ Gitlab::ForcePushCheck.force_push?(project, oldrev, newrev)
end
private