summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2014-09-09 11:58:46 +0200
committerJacob Vosmaer <contact@jacobvosmaer.nl>2014-09-09 12:02:07 +0200
commit96e85094ee2917ad4bf63a0aa075257e15dedf9b (patch)
tree89a3c22795eb6bf4169e6232eb2aa7cf994eed83
parent1fc4ed6e730a92d35955d68c5228864d0f0a0b21 (diff)
downloadgitlab-shell-96e85094ee2917ad4bf63a0aa075257e15dedf9b.tar.gz
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.
-rw-r--r--CHANGELOG1
-rwxr-xr-xbin/create-hooks6
2 files changed, 6 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 5c48b02..c0e37f9 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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
diff --git a/bin/create-hooks b/bin/create-hooks
index d6f07c7..4efa650 100755
--- a/bin/create-hooks
+++ b/bin/create-hooks
@@ -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