summaryrefslogtreecommitdiff
path: root/bin/create-hooks
blob: b590aab19a4c8d0e4f4d36d65cc27d7e5e6143b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env ruby

# Recreate GitLab hooks in the Git repositories managed by GitLab.
#
# This script is used when restoring a GitLab backup.

$:.unshift File.expand_path('../lib', __FILE__)
require 'gitlab_init'
require 'gitlab_projects'

Dir["#{GitlabConfig.new.repos_path}/*/*.git"].each do |repo|
  begin
    GitlabProjects.create_hooks(repo)
  rescue Errno::ENOENT
    # The user must have deleted their repository. Ignore.
  end
end