summaryrefslogtreecommitdiff
path: root/lib/gitlab/checks
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2016-12-09 15:52:20 +0530
committerTimothy Andrew <mail@timothyandrew.net>2016-12-16 23:32:25 +0530
commitc937aec1f7ba1f102995fefaef2141e7ed90f5fd (patch)
tree203f2dcc15ae1d2ac61e34e6bf0b8553e1d05f92 /lib/gitlab/checks
parenta2b39feb1a3ae6fe2615418bb759bf39125e5d0e (diff)
downloadgitlab-ce-c937aec1f7ba1f102995fefaef2141e7ed90f5fd.tar.gz
Check the exit code while invoking git in the force push check.
Previously, we were calling out to `popen` without asserting on the returned exit-code. Now we raise a `RuntimeError` if the exit code is non-zero.
Diffstat (limited to 'lib/gitlab/checks')
-rw-r--r--lib/gitlab/checks/force_push.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/gitlab/checks/force_push.rb b/lib/gitlab/checks/force_push.rb
index 589525e40ad..e1c967a1f89 100644
--- a/lib/gitlab/checks/force_push.rb
+++ b/lib/gitlab/checks/force_push.rb
@@ -8,8 +8,13 @@ module Gitlab
if Gitlab::Git.blank_ref?(oldrev) || Gitlab::Git.blank_ref?(newrev)
false
else
- missed_ref, _ = Gitlab::Git::RevList.new(oldrev, newrev, project: project, env: env).execute
- missed_ref.present?
+ missed_ref, exit_status = Gitlab::Git::RevList.new(oldrev, newrev, project: project, env: env).execute
+
+ if exit_status == 0
+ missed_ref.present?
+ else
+ raise RuntimeError, "Got a non-zero exit code while calling out to `git rev-list` in the force-push check."
+ end
end
end
end