blob: bb1684a0123ada6cba51ef6185e78a7c410716be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#!/usr/bin/env ruby
require 'optparse'
require_relative 'run'
PROGNAME = 'vendor-gitaly-proto'
USAGE = "Usage: #{PROGNAME} [--fork GITALY_PROTO_FORK_REPO] REVISION"
ORIGIN = 'gitlab.com/gitlab-org/gitaly-proto'
def main(revision, repo:)
if repo == ORIGIN
run!(%W[go mod edit -dropreplace=#{ORIGIN}])
run!(%W[go get #{ORIGIN}@#{revision}])
else
run!(%W[go mod edit -replace=#{ORIGIN}=#{repo}@#{revision}])
end
run!(%w[go mod tidy])
end
options = ARGV.getopts(nil, 'fork:')
abort USAGE unless ARGV.count == 1
main(ARGV.first, repo: options['fork'] || ORIGIN)
|