Skip to content

Commit 73e2cf5

Browse files
author
Nick Thomas
committed
Remove the GitlabProjects implementation
1 parent f8f3148 commit 73e2cf5

File tree

5 files changed

+24
-1267
lines changed

5 files changed

+24
-1267
lines changed

README.md

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -77,41 +77,6 @@ To install gitlab-shell you also need a Go compiler version 1.8 or newer. https:
7777

7878
./bin/check
7979

80-
## Repos
81-
82-
Add repo:
83-
84-
./bin/gitlab-projects add-project gitlab/gitlab-ci.git
85-
86-
Remove repo:
87-
88-
./bin/gitlab-projects rm-project gitlab/gitlab-ci.git
89-
90-
List repos:
91-
92-
./bin/gitlab-projects list-projects
93-
94-
Import repo:
95-
96-
# Default timeout is 2 minutes
97-
./bin/gitlab-projects import-project randx/six.git https://github.com/randx/six.git
98-
99-
# Override timeout in seconds
100-
./bin/gitlab-projects import-project randx/six.git https://github.com/randx/six.git 90
101-
102-
Fork repo:
103-
104-
./bin/gitlab-projects fork-project gitlab/gitlab-ci.git randx
105-
106-
Create tag (lightweight & annotated):
107-
108-
./bin/gitlab-projects create-tag gitlab/gitlab-ci.git v3.0.0 3-0-stable
109-
./bin/gitlab-projects create-tag gitlab/gitlab-ci.git v3.0.0 3-0-stable 'annotated message goes here'
110-
111-
Gc repo:
112-
113-
./bin/gitlab-projects gc gitlab/gitlab-ci.git
114-
11580
## Keys
11681

11782
Add key:

bin/create-hooks

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,38 @@
55
# This script is used when restoring a GitLab backup.
66

77
require_relative '../lib/gitlab_init'
8-
require File.join(ROOT_PATH, 'lib', 'gitlab_projects')
98
require File.join(ROOT_PATH, 'lib', 'gitlab_metrics')
109

10+
def create_hooks(path)
11+
global_hooks_directory = File.join(ROOT_PATH, 'hooks')
12+
local_hooks_directory = File.join(path, 'hooks')
13+
real_local_hooks_directory = :not_found
14+
15+
begin
16+
real_local_hooks_directory = File.realpath(local_hooks_directory)
17+
rescue Errno::ENOENT
18+
# real_local_hooks_directory == :not_found
19+
end
20+
21+
if real_local_hooks_directory != File.realpath(global_hooks_directory)
22+
if File.exist?(local_hooks_directory)
23+
$logger.info "Moving existing hooks directory and symlinking global hooks directory for #{path}."
24+
FileUtils.mv(local_hooks_directory, "#{local_hooks_directory}.old.#{Time.now.to_i}")
25+
end
26+
FileUtils.ln_sf(global_hooks_directory, local_hooks_directory)
27+
else
28+
$logger.info "Hooks already exist for #{path}."
29+
true
30+
end
31+
end
32+
1133
repository_storage_paths = ARGV
1234

1335
repository_storage_paths.each do |repo_path|
1436
Dir["#{repo_path.chomp('/')}/**/*.git"].each do |repo|
1537
begin
1638
GitlabMetrics.measure('command-create-hooks') do
17-
GitlabProjects.create_hooks(repo)
39+
create_hooks(repo)
1840
end
1941
rescue Errno::ENOENT
2042
# The user must have deleted their repository. Ignore.

bin/gitlab-projects

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)