Commit d299e7ef authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Make force push detection actually work

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent d5adeb1f
......@@ -15,6 +15,7 @@ class GitlabNet
action: cmd,
ref: ref,
project: project_name,
forced_push: forced_push,
}
params.merge!(oldrev: oldrev) if oldrev
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment