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

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

require_relative '../lib/gitlab_init'
require File.join(ROOT_PATH, 'lib', 'gitlab_projects')

repository_storage_paths = ARGV

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