]> git.pld-linux.org Git - packages/gitlab-shell.git/commitdiff
patch to allow disabling hooks setup auto/th/gitlab-shell-4.0.0-1
authorElan Ruusamäe <glen@delfi.ee>
Tue, 6 Dec 2016 07:44:30 +0000 (09:44 +0200)
committerElan Ruusamäe <glen@delfi.ee>
Tue, 6 Dec 2016 07:44:30 +0000 (09:44 +0200)
gitlab-shell.spec
skip_hooks_setup.patch [new file with mode: 0644]

index 08699831147da9e98590f3990789734d6776c5a6..bc9ed2032a8a3100a867835bd4f4881be3524d18 100644 (file)
@@ -6,8 +6,9 @@ License:        MIT
 Group:         Applications/Shells
 Source0:       https://gitlab.com/gitlab-org/gitlab-shell/repository/archive.tar.bz2?ref=v%{version}&/%{name}-%{version}.tar.bz2
 # Source0-md5: 54a8a5374007277982dea2f9f07a99d1
-Patch0:                config.yml.patch
-Patch1:                unvendor-redis.patch
+Patch0:                unvendor-redis.patch
+Patch1:                skip_hooks_setup.patch
+Patch2:                config.yml.patch
 URL:           https://gitlab.com/gitlab-org/gitlab-shell
 BuildRequires: rpm-rubyprov
 BuildRequires: rpmbuild(macros) >= 1.665
@@ -30,9 +31,10 @@ a replacement for Bash or Zsh.
 %prep
 %setup -qc
 mv %{name}-*/* .
-cp -p config.yml.example config.yml
 %patch0 -p1
 %patch1 -p1
+cp -p config.yml.example config.yml
+%patch2 -p1
 
 %{__sed} -i -e '1 s,#!.*ruby,#!%{__ruby},' bin/* hooks/*
 
diff --git a/skip_hooks_setup.patch b/skip_hooks_setup.patch
new file mode 100644 (file)
index 0000000..60f4bb1
--- /dev/null
@@ -0,0 +1,54 @@
+commit 9ad4db607e008110de4cfb6b6d971d0e8b53edac
+Author: Elan Ruusamäe <glen@delfi.ee>
+Date:   Tue Dec 6 09:43:09 2016 +0200
+
+    add a way to disable hooks setup
+    
+    really useful when migrating slowly to gitlab without affecting existing
+    repositories
+
+diff --git a/config.yml.example b/config.yml.example
+index 0164830..de52a31 100644
+--- a/config.yml.example
++++ b/config.yml.example
+@@ -69,6 +69,10 @@ audit_usernames: false
+ # For CentOS: sudo yum install epel-release && sudo yum install git-annex
+ git_annex_enabled: false
++# disable hooks setup in git repos
++# useful when migrating
++hooks_setup_disabled: false
++
+ # Git trace log file.
+ # If set, git commands receive GIT_TRACE* environment variables
+ # See https://git-scm.com/book/es/v2/Git-Internals-Environment-Variables#Debugging for documentation
+diff --git a/lib/gitlab_config.rb b/lib/gitlab_config.rb
+index f8a10cf..3714d8c 100644
+--- a/lib/gitlab_config.rb
++++ b/lib/gitlab_config.rb
+@@ -51,6 +51,10 @@ class GitlabConfig
+     @config['git_annex_enabled'] ||= false
+   end
++  def hooks_setup_disabled?
++    @config['hooks_setup_disabled'] ||= false
++  end
++
+   def git_trace_log_file
+     @config['git_trace_log_file']
+   end
+diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb
+index 505b49e..e8ad797 100644
+--- a/lib/gitlab_projects.rb
++++ b/lib/gitlab_projects.rb
+@@ -23,6 +23,10 @@ class GitlabProjects
+   attr_reader :full_path
+   def self.create_hooks(path)
++    config = GitlabConfig.new
++    # local administrator might have disabled hooks setup
++    return true if config.hooks_setup_disabled?
++
+     local_hooks_directory = File.join(path, 'hooks')
+     real_local_hooks_directory = :not_found
+     begin
This page took 0.071466 seconds and 4 git commands to generate.