1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
|
Forwarded: https://gitlab.com/gitlab-org/gitlab-shell/issues/30
Index: gitlab-shell/bin/check
===================================================================
--- gitlab-shell.orig/bin/check
+++ gitlab-shell/bin/check
@@ -1,7 +1,8 @@
#!/usr/bin/env ruby
-require_relative '../lib/gitlab_init'
-require_relative '../lib/gitlab_net'
+$:.unshift File.expand_path('../lib', __FILE__)
+require 'gitlab_init'
+require 'gitlab_net'
#
# GitLab shell check task
Index: gitlab-shell/bin/create-hooks
===================================================================
--- gitlab-shell.orig/bin/create-hooks
+++ gitlab-shell/bin/create-hooks
@@ -4,9 +4,10 @@
#
# This script is used when restoring a GitLab backup.
-require_relative '../lib/gitlab_init'
-require File.join(ROOT_PATH, 'lib', 'gitlab_projects')
-require File.join(ROOT_PATH, 'lib', 'gitlab_metrics')
+$:.unshift File.expand_path('../lib', __FILE__)
+require 'gitlab_init'
+require 'gitlab_projects'
+require 'gitlab_metrics'
repository_storage_paths = ARGV
Index: gitlab-shell/bin/gitlab-keys
===================================================================
--- gitlab-shell.orig/bin/gitlab-keys
+++ gitlab-shell/bin/gitlab-keys
@@ -1,6 +1,7 @@
#!/usr/bin/env ruby
-require_relative '../lib/gitlab_init'
+$:.unshift File.expand_path('../lib', __FILE__)
+require 'gitlab_init'
#
# GitLab Keys shell. Add/remove keys from ~/.ssh/authorized_keys
@@ -17,7 +18,7 @@ require_relative '../lib/gitlab_init'
# /bin/gitlab-keys clear
#
-require File.join(ROOT_PATH, 'lib', 'gitlab_keys')
+require 'gitlab_keys'
# Return non-zero if command execution was not successful
if GitlabKeys.new.exec
Index: gitlab-shell/bin/gitlab-projects
===================================================================
--- gitlab-shell.orig/bin/gitlab-projects
+++ gitlab-shell/bin/gitlab-projects
@@ -1,7 +1,8 @@
#!/usr/bin/env ruby
-require_relative '../lib/gitlab_init'
+$:.unshift File.expand_path('../lib', __FILE__)
+require 'gitlab_init'
#
# GitLab Projects shell. Add/remove projects from /home/git/repositories
@@ -19,7 +20,7 @@ require_relative '../lib/gitlab_init'
#
# /bin/gitlab-projects import-project randx/six.git https://github.com/randx/six.git
#
-require File.join(ROOT_PATH, 'lib', 'gitlab_projects')
+require 'gitlab_projects'
# Return non-zero if command execution was not successful
if GitlabProjects.new.exec
Index: gitlab-shell/bin/install
===================================================================
--- gitlab-shell.orig/bin/install
+++ gitlab-shell/bin/install
@@ -1,6 +1,7 @@
#!/usr/bin/env ruby
-require_relative '../lib/gitlab_init'
+$:.unshift File.expand_path('../lib', __FILE__)
+require 'gitlab_init'
#
# GitLab shell, invoked from ~/.ssh/authorized_keys
Index: gitlab-shell/bin/gitlab-shell
===================================================================
--- gitlab-shell.orig/bin/gitlab-shell
+++ gitlab-shell/bin/gitlab-shell
@@ -8,14 +8,14 @@ end
key_id = /key-[0-9]+/.match(ARGV.join).to_s
original_cmd = ENV.delete('SSH_ORIGINAL_COMMAND')
-require_relative '../lib/gitlab_init'
+require 'gitlab_init'
#
#
# GitLab shell, invoked from ~/.ssh/authorized_keys
#
#
-require File.join(ROOT_PATH, 'lib', 'gitlab_shell')
+require 'gitlab_shell'
if GitlabShell.new(key_id).exec(original_cmd)
exit 0
Index: gitlab-shell/hooks/post-receive
===================================================================
--- gitlab-shell.orig/hooks/post-receive
+++ gitlab-shell/hooks/post-receive
@@ -7,8 +7,9 @@ refs = $stdin.read
key_id = ENV.delete('GL_ID')
repo_path = Dir.pwd
-require_relative '../lib/gitlab_custom_hook'
-require_relative '../lib/gitlab_post_receive'
+$:.unshift File.expand_path('../lib', __FILE__)
+require 'gitlab_custom_hook'
+require 'gitlab_post_receive'
if GitlabPostReceive.new(repo_path, key_id, refs).exec &&
GitlabCustomHook.new(key_id).post_receive(refs, repo_path)
Index: gitlab-shell/hooks/update
===================================================================
--- gitlab-shell.orig/hooks/update
+++ gitlab-shell/hooks/update
@@ -9,7 +9,8 @@ new_value = ARGV[2]
repo_path = Dir.pwd
key_id = ENV.delete('GL_ID')
-require_relative '../lib/gitlab_custom_hook'
+$:.unshift File.expand_path('../lib', __FILE__)
+require 'gitlab_custom_hook'
if GitlabCustomHook.new(key_id).update(ref_name, old_value, new_value, repo_path)
exit 0
Index: gitlab-shell/hooks/pre-receive
===================================================================
--- gitlab-shell.orig/hooks/pre-receive
+++ gitlab-shell/hooks/pre-receive
@@ -8,9 +8,10 @@ key_id = ENV.delete('GL_ID')
protocol = ENV.delete('GL_PROTOCOL')
repo_path = Dir.pwd
-require_relative '../lib/gitlab_custom_hook'
-require_relative '../lib/gitlab_reference_counter'
-require_relative '../lib/gitlab_access'
+$:.unshift File.expand_path('../lib', __FILE__)
+require 'gitlab_custom_hook'
+require 'gitlab_access'
+require 'gitlab_reference_counter'
# It's important that on pre-receive `increase_reference_counter` gets executed
# last so that it only runs if everything else succeeded. On post-receive on the
|