Commit 96e85094 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Ignore missing repositories in create-hooks

When bin/create-hooks is run against a live GitLab server, there is
a possibility of race conditions when a user deletes one of their
repositories after bin/create-hooks found it. With this change,
bin/create-hooks will ignore missing file errors.
parent 1fc4ed6e
......@@ -3,6 +3,7 @@ v2.0.0
- Replace raise with abort when checking path to prevent path exposure
- Handle invalid number of arguments on remote commands
- Replace update hook with pre-receive and post-receive hooks.
- Ignore missing repositories in create-hooks
v1.9.7
- Increased test coverage
......
......@@ -8,5 +8,9 @@ require_relative '../lib/gitlab_init'
require File.join(ROOT_PATH, 'lib', 'gitlab_projects')
Dir["#{GitlabConfig.new.repos_path}/*/*.git"].each do |repo|
GitlabProjects.create_hooks(repo)
begin
GitlabProjects.create_hooks(repo)
rescue Errno::ENOENT
# The user must have deleted their repository. Ignore.
end
end
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