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 ...@@ -15,6 +15,7 @@ class GitlabNet
action: cmd, action: cmd,
ref: ref, ref: ref,
project: project_name, project: project_name,
forced_push: forced_push,
} }
params.merge!(oldrev: oldrev) if oldrev params.merge!(oldrev: oldrev) if oldrev
......
...@@ -23,7 +23,7 @@ class GitlabUpdate ...@@ -23,7 +23,7 @@ class GitlabUpdate
end end
def forced_push? 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 missed_refs.split("\n").size > 0
end end
...@@ -32,7 +32,7 @@ class GitlabUpdate ...@@ -32,7 +32,7 @@ class GitlabUpdate
# get value from it # get value from it
ENV['GL_ID'] = nil 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 update_redis
exit 0 exit 0
else 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