File: create-hooks

package info (click to toggle)
gitlab-shell 3.6.6-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 760 kB
  • ctags: 733
  • sloc: ruby: 6,084; makefile: 15; sh: 14
file content (24 lines) | stat: -rwxr-xr-x 622 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/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'
require 'gitlab_metrics'

repository_storage_paths = ARGV

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