summaryrefslogtreecommitdiff
path: root/lib/gitlab_update.rb
diff options
context:
space:
mode:
authorSteven Thonus <steven@ln2.nl>2014-01-28 22:42:36 +0100
committerSteven Thonus <steven@ln2.nl>2014-03-25 22:13:15 +0100
commitf79bb5a307cd8ec5fa1c765779640667e70da5b4 (patch)
treef8bd79c49f75cc446095a75ec48eccd68e13d90d /lib/gitlab_update.rb
parentce88b74d52410250427116349d06a74359a65b48 (diff)
downloadgitlab-shell-f79bb5a307cd8ec5fa1c765779640667e70da5b4.tar.gz
first setup to protect protected branched to force updates
rebased for new code
Diffstat (limited to 'lib/gitlab_update.rb')
-rw-r--r--lib/gitlab_update.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/gitlab_update.rb b/lib/gitlab_update.rb
index 742d5fd..43d5b07 100644
--- a/lib/gitlab_update.rb
+++ b/lib/gitlab_update.rb
@@ -22,12 +22,17 @@ class GitlabUpdate
@newrev = ARGV[2]
end
+ def forced_push?
+ missed_refs = IO.popen(%W(git rev-list #{@newrev}..#{@oldrev} --)).read
+ missed_refs.split("\n").size > 0
+ end
+
def exec
# reset GL_ID env since we already
# get value from it
ENV['GL_ID'] = nil
- if api.allowed?('git-receive-pack', @repo_name, @actor, @ref_name, @oldrev, @newrev)
+ if api.allowed?('git-receive-pack', @repo_name, @actor, @ref_name, @oldrev, @newrev, forced_push)
update_redis
exit 0
else