summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-04-03 15:03:02 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-04-03 15:03:02 +0300
commitd299e7ef2be2504e696b071110bbed2dd2710db5 (patch)
tree155a4427bb0c48a4d6e01c92df0acdd55bf64b0d
parentd5adeb1f781cd92c70453b5e4273d4afe5b5a2d1 (diff)
downloadgitlab-shell-d299e7ef2be2504e696b071110bbed2dd2710db5.tar.gz
Make force push detection actually work
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r--lib/gitlab_net.rb1
-rw-r--r--lib/gitlab_update.rb4
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb
index cab64bd..28971ef 100644
--- a/lib/gitlab_net.rb
+++ b/lib/gitlab_net.rb
@@ -15,6 +15,7 @@ class GitlabNet
action: cmd,
ref: ref,
project: project_name,
+ forced_push: forced_push,
}
params.merge!(oldrev: oldrev) if oldrev
diff --git a/lib/gitlab_update.rb b/lib/gitlab_update.rb
index 43d5b07..d581787 100644
--- a/lib/gitlab_update.rb
+++ b/lib/gitlab_update.rb
@@ -23,7 +23,7 @@ class GitlabUpdate
end
def forced_push?
- missed_refs = IO.popen(%W(git rev-list #{@newrev}..#{@oldrev} --)).read
+ missed_refs = IO.popen(%W(git rev-list #{@oldrev} ^#{@newrev})).read
missed_refs.split("\n").size > 0
end
@@ -32,7 +32,7 @@ class GitlabUpdate
# get value from it
ENV['GL_ID'] = nil
- if api.allowed?('git-receive-pack', @repo_name, @actor, @ref_name, @oldrev, @newrev, forced_push)
+ if api.allowed?('git-receive-pack', @repo_name, @actor, @ref_name, @oldrev, @newrev, forced_push?)
update_redis
exit 0
else