1 commit 9ad4db607e008110de4cfb6b6d971d0e8b53edac
2 Author: Elan Ruusamäe <glen@delfi.ee>
3 Date: Tue Dec 6 09:43:09 2016 +0200
5 add a way to disable hooks setup
7 really useful when migrating slowly to gitlab without affecting existing
10 diff --git a/config.yml.example b/config.yml.example
11 index 0164830..de52a31 100644
12 --- a/config.yml.example
13 +++ b/config.yml.example
14 @@ -69,6 +69,10 @@ audit_usernames: false
15 # For CentOS: sudo yum install epel-release && sudo yum install git-annex
16 git_annex_enabled: false
18 +# disable hooks setup in git repos
19 +# useful when migrating
20 +hooks_setup_disabled: false
23 # If set, git commands receive GIT_TRACE* environment variables
24 # See https://git-scm.com/book/es/v2/Git-Internals-Environment-Variables#Debugging for documentation
25 diff --git a/lib/gitlab_config.rb b/lib/gitlab_config.rb
26 index f8a10cf..3714d8c 100644
27 --- a/lib/gitlab_config.rb
28 +++ b/lib/gitlab_config.rb
29 @@ -51,6 +51,10 @@ class GitlabConfig
30 @config['git_annex_enabled'] ||= false
33 + def hooks_setup_disabled?
34 + @config['hooks_setup_disabled'] ||= false
37 def git_trace_log_file
38 @config['git_trace_log_file']
40 diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb
41 index 505b49e..e8ad797 100644
42 --- a/lib/gitlab_projects.rb
43 +++ b/lib/gitlab_projects.rb
44 @@ -23,6 +23,10 @@ class GitlabProjects
45 attr_reader :full_path
47 def self.create_hooks(path)
48 + config = GitlabConfig.new
49 + # local administrator might have disabled hooks setup
50 + return true if config.hooks_setup_disabled?
52 local_hooks_directory = File.join(path, 'hooks')
53 real_local_hooks_directory = :not_found