Commit 31c7cb806d5cbf3db77c56c0c3806b58c9f19cae

Authored by Jacob Vosmaer
1 parent c7c801a8

Update gitlab-shell to drop omnibus-gitlab patch

config/patches/gitlab-shell/create_hooks.patch
@@ -1,126 +0,0 @@ @@ -1,126 +0,0 @@
1 -diff --git a/bin/create-hooks b/bin/create-hooks  
2 -new file mode 100755  
3 -index 0000000..d6f07c7  
4 ---- /dev/null  
5 -+++ b/bin/create-hooks  
6 -@@ -0,0 +1,12 @@  
7 -+#!/usr/bin/env ruby  
8 -+  
9 -+# Recreate GitLab hooks in the Git repositories managed by GitLab.  
10 -+#  
11 -+# This script is used when restoring a GitLab backup.  
12 -+  
13 -+require_relative '../lib/gitlab_init'  
14 -+require File.join(ROOT_PATH, 'lib', 'gitlab_projects')  
15 -+  
16 -+Dir["#{GitlabConfig.new.repos_path}/*/*.git"].each do |repo|  
17 -+ GitlabProjects.create_hooks(repo)  
18 -+end  
19 -diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb  
20 -index fec204c..b3ff372 100644  
21 ---- a/lib/gitlab_projects.rb  
22 -+++ b/lib/gitlab_projects.rb  
23 -@@ -42,6 +42,12 @@ class GitlabProjects  
24 - end  
25 - end  
26 -  
27 -+ def self.create_hooks(path)  
28 -+ hook = File.join(path, 'hooks', 'update')  
29 -+ File.delete(hook) if File.exists?(hook)  
30 -+ File.symlink(File.join(ROOT_PATH, 'hooks', 'update'), hook)  
31 -+ end  
32 -+  
33 - protected  
34 -  
35 - def create_branch  
36 -@@ -74,13 +80,7 @@ class GitlabProjects  
37 - $logger.info "Adding project #{@project_name} at <#{full_path}>."  
38 - FileUtils.mkdir_p(full_path, mode: 0770)  
39 - cmd = %W(git --git-dir=#{full_path} init --bare)  
40 -- system(*cmd) && create_hooks(full_path)  
41 -- end  
42 --  
43 -- def create_hooks(path)  
44 -- hook = File.join(path, 'hooks', 'update')  
45 -- File.delete(hook) if File.exists?(hook)  
46 -- File.symlink(File.join(ROOT_PATH, 'hooks', 'update'), hook)  
47 -+ system(*cmd) && self.class.create_hooks(full_path)  
48 - end  
49 -  
50 - def rm_project  
51 -@@ -94,7 +94,7 @@ class GitlabProjects  
52 - @source = ARGV.shift  
53 - $logger.info "Importing project #{@project_name} from <#{@source}> to <#{full_path}>."  
54 - cmd = %W(git clone --bare -- #{@source} #{full_path})  
55 -- system(*cmd) && create_hooks(full_path)  
56 -+ system(*cmd) && self.class.create_hooks(full_path)  
57 - end  
58 -  
59 - # Move repository from one directory to another  
60 -@@ -156,7 +156,7 @@ class GitlabProjects  
61 -  
62 - $logger.info "Forking project from <#{full_path}> to <#{full_destination_path}>."  
63 - cmd = %W(git clone --bare -- #{full_path} #{full_destination_path})  
64 -- system(*cmd) && create_hooks(full_destination_path)  
65 -+ system(*cmd) && self.class.create_hooks(full_destination_path)  
66 - end  
67 -  
68 - def update_head  
69 -diff --git a/spec/gitlab_projects_spec.rb b/spec/gitlab_projects_spec.rb  
70 -index bbe27e2..4341ca5 100644  
71 ---- a/spec/gitlab_projects_spec.rb  
72 -+++ b/spec/gitlab_projects_spec.rb  
73 -@@ -95,7 +95,7 @@ describe GitlabProjects do  
74 -  
75 - it "should create a directory" do  
76 - gl_projects.stub(system: true)  
77 -- gl_projects.stub(create_hooks: true)  
78 -+ GitlabProjects.stub(create_hooks: true)  
79 - gl_projects.exec  
80 - File.exists?(tmp_repo_path).should be_true  
81 - end  
82 -@@ -103,7 +103,7 @@ describe GitlabProjects do  
83 - it "should receive valid cmd" do  
84 - valid_cmd = ['git', "--git-dir=#{tmp_repo_path}", 'init', '--bare']  
85 - gl_projects.should_receive(:system).with(*valid_cmd).and_return(true)  
86 -- gl_projects.should_receive(:create_hooks).with(tmp_repo_path)  
87 -+ GitlabProjects.should_receive(:create_hooks).with(tmp_repo_path)  
88 - gl_projects.exec  
89 - end  
90 -  
91 -diff --git a/support/rewrite-hooks.sh b/support/rewrite-hooks.sh  
92 -index 3c96b6f..585eaeb 100755  
93 ---- a/support/rewrite-hooks.sh  
94 -+++ b/support/rewrite-hooks.sh  
95 -@@ -1,28 +1,5 @@  
96 - #!/bin/bash  
97 -+# This script is deprecated. Use bin/create-hooks instead.  
98 -  
99 --# $1 is an optional argument specifying the location of the repositories directory.  
100 --# Defaults to /home/git/repositories if not provided  
101 --  
102 --home_dir="/home/git"  
103 --src=${1:-"$home_dir/repositories"}  
104 --  
105 --function create_link_in {  
106 -- ln -s -f "$home_dir/gitlab-shell/hooks/update" "$1/hooks/update"  
107 --}  
108 --  
109 --for dir in `ls "$src/"`  
110 --do  
111 -- if [ -d "$src/$dir" ]; then  
112 -- if [[ "$dir" =~ ^.*\.git$ ]]  
113 -- then  
114 -- create_link_in "$src/$dir"  
115 -- else  
116 -- for subdir in `ls "$src/$dir/"`  
117 -- do  
118 -- if [ -d "$src/$dir/$subdir" ] && [[ "$subdir" =~ ^.*\.git$ ]]; then  
119 -- create_link_in "$src/$dir/$subdir"  
120 -- fi  
121 -- done  
122 -- fi  
123 -- fi  
124 --done  
125 -+gitlab_shell_dir="$(cd $(dirname $0) && pwd)/.."  
126 -+exec ${gitlab_shell_dir}/bin/create-hooks  
config/software/gitlab-shell.rb
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 # 17 #
18 18
19 name "gitlab-shell" 19 name "gitlab-shell"
20 -version "v1.8.0" 20 +version "79bceae69cb5750d6567b223597999bfa91cb3b9"
21 21
22 dependency "ruby" 22 dependency "ruby"
23 dependency "rsync" 23 dependency "rsync"
@@ -25,9 +25,6 @@ dependency &quot;rsync&quot; @@ -25,9 +25,6 @@ dependency &quot;rsync&quot;
25 source :git => "https://gitlab.com/gitlab-org/gitlab-shell.git" 25 source :git => "https://gitlab.com/gitlab-org/gitlab-shell.git"
26 26
27 build do 27 build do
28 - # patch gitlab-shell 1.8.0 to correctly create hooks during backup restore  
29 - patch :source => "create_hooks.patch"  
30 -  
31 command "mkdir -p #{install_dir}/embedded/service/gitlab-shell" 28 command "mkdir -p #{install_dir}/embedded/service/gitlab-shell"
32 command "#{install_dir}/embedded/bin/rsync -a --delete --exclude=.git/*** --exclude=.gitignore ./ #{install_dir}/embedded/service/gitlab-shell/" 29 command "#{install_dir}/embedded/bin/rsync -a --delete --exclude=.git/*** --exclude=.gitignore ./ #{install_dir}/embedded/service/gitlab-shell/"
33 block do 30 block do