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
|
Forwarded: https://gitlab.com/gitlab-org/gitlab-shell/issues/30
--- a/bin/check
+++ b/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
--- a/bin/create-hooks
+++ b/bin/create-hooks
@@ -4,8 +4,8 @@
#
# This script is used when restoring a GitLab backup.
-require_relative '../lib/gitlab_init'
-require File.join(ROOT_PATH, 'lib', 'gitlab_metrics')
+require 'gitlab_init'
+require 'gitlab_metrics'
require 'fileutils'
def create_hooks(path)
--- a/bin/gitlab-keys
+++ b/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 @@
# /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
--- a/bin/install
+++ b/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
--- a/hooks/post-receive
+++ b/hooks/post-receive
@@ -8,8 +8,9 @@
gl_repository = ENV['GL_REPOSITORY']
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(gl_repository, repo_path, key_id, refs).exec &&
GitlabCustomHook.new(repo_path, key_id).post_receive(refs)
--- a/hooks/update
+++ b/hooks/update
@@ -9,7 +9,8 @@
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(repo_path, key_id).update(ref_name, old_value, new_value)
exit 0
--- a/hooks/pre-receive
+++ b/hooks/pre-receive
@@ -15,9 +15,9 @@
result && result['reference_counter_increased']
end
-require_relative '../lib/gitlab_custom_hook'
-require_relative '../lib/gitlab_access'
-require_relative '../lib/gitlab_net'
+require 'gitlab_custom_hook'
+require 'gitlab_access'
+require 'gitlab_net'
# 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
--- a/bin/authorized_keys
+++ b/bin/authorized_keys
@@ -13,9 +13,9 @@
key = ARGV[0]
abort "# No key provided" if key.nil? || key.empty?
-require_relative "../lib/gitlab_init"
-require_relative "../lib/gitlab_net"
-require_relative "../lib/gitlab_keys"
+require "gitlab_init"
+require "gitlab_net"
+require "gitlab_keys"
authorized_key = GitlabNet.new.authorized_key(key)
if authorized_key.nil?
--- a/bin/gitlab-shell-authorized-keys-check
+++ b/bin/gitlab-shell-authorized-keys-check
@@ -30,9 +30,9 @@
key = ARGV[2]
abort "# No key provided" if key.nil? || key == ''
-require_relative '../lib/gitlab_init'
-require_relative '../lib/gitlab_net'
-require_relative '../lib/gitlab_keys'
+require 'gitlab_init'
+require 'gitlab_net'
+require 'gitlab_keys'
authorized_key = GitlabNet.new.authorized_key(key)
if authorized_key.nil?
--- a/bin/gitlab-shell-ruby
+++ b/bin/gitlab-shell-ruby
@@ -7,7 +7,7 @@
original_cmd = ENV.delete('SSH_ORIGINAL_COMMAND')
-require_relative '../lib/gitlab_init'
+require 'gitlab_init'
#
#
@@ -15,7 +15,7 @@
# AuthorizedPrincipalsCommand in the key-less SSH CERT mode.
#
#
-require File.join(ROOT_PATH, 'lib', 'gitlab_shell')
+require 'gitlab_shell'
# We must match e.g. "key-12345" anywhere on the command-line. See
# https://gitlab.com/gitlab-org/gitlab-shell/issues/145
|