blob: 124128ef52766632f9e19405c980544f853bcd16 (
plain)
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
|
#!/usr/bin/env ruby
# These files and directories of gitlab-ce will be vendored
FILE_LIST = %w[
lib/gitlab/git.rb
lib/gitlab/git
lib/gitlab/encoding_helper.rb
lib/gitlab/utils/strong_memoize.rb
lib/gitlab/version_info.rb
].freeze
REMOTE = 'https://gitlab.com/gitlab-org/gitlab-ce'.freeze
# This directory in Gitaly will be the 'root' of gitlab-ce
VENDOR_DIR = 'ruby/vendor/gitlab_git'.freeze
require_relative 'run.rb'
require 'tempfile'
def main
if ARGV.count != 1
abort "usage: #{$0} BRANCH_OR_TAG"
end
revision = ARGV.first
revision_sha = nil
Dir.mktmpdir do |dir|
gitlab_dir = File.join(dir, 'gitlab')
run!(%W[git clone --depth=1 -b #{revision} #{REMOTE}.git #{gitlab_dir}])
revision_sha = capture!(%w[git rev-parse HEAD], gitlab_dir).chomp
FileUtils.rm_rf(VENDOR_DIR)
FileUtils.mkdir_p(VENDOR_DIR)
run!(%w[rsync -avR] + FILE_LIST + %W[#{File.join(Dir.pwd, VENDOR_DIR)}/], gitlab_dir)
end
File.write(File.join(VENDOR_DIR, 'REVISION'), "#{revision_sha}\n")
File.write(File.join(VENDOR_DIR, 'ORIGIN'), "Cloned from #{REMOTE}.\n")
end
main
|