blob: 7450719937b106898d035832ef580d741fbcd3b2 (
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
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
|
#!/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
].freeze
# We have (already) stopped vendoring these files.
EXCLUDE = %w[
lib/gitlab/git/attributes_at_ref_parser.rb
lib/gitlab/git/attributes_parser.rb
lib/gitlab/git/blame.rb
lib/gitlab/git/blob.rb
lib/gitlab/git/branch.rb
lib/gitlab/git/blob_snippet.rb
lib/gitlab/git/commit.rb
lib/gitlab/git/commit_stats.rb
lib/gitlab/git/compare.rb
lib/gitlab/git/conflict/resolver.rb
lib/gitlab/git/diff.rb
lib/gitlab/git/diff_collection.rb
lib/gitlab/git/gitmodules_parser.rb
lib/gitlab/git/hook_env.rb
lib/gitlab/git/index.rb
lib/gitlab/git/lfs_changes.rb
lib/gitlab/git/lfs_pointer_file.rb
lib/gitlab/git/merge_base.rb
lib/gitlab/git/ref.rb
lib/gitlab/git/rev_list.rb
lib/gitlab/git/storage/
lib/gitlab/git/storage.rb
lib/gitlab/git/tag.rb
lib/gitlab/git/tree.rb
lib/gitlab/git/version.rb
lib/gitlab/git/wiki.rb
lib/gitlab/git/wiki_file.rb
lib/gitlab/git/wiki_page.rb
lib/gitlab/git/wiki_page_version.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 --quiet --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)
args = %w[rsync -avR]
args += EXCLUDE.map { |e| "--exclude=#{e}" }
args += FILE_LIST
args += %W[#{File.join(Dir.pwd, VENDOR_DIR)}/]
run!(args, 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
|