debian-mirror-gitlab/lib/gitlab/git/remote_mirror.rb

31 lines
804 B
Ruby
Raw Normal View History

2018-12-23 12:14:25 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
module Gitlab
module Git
class RemoteMirror
2018-12-13 13:39:08 +05:30
include Gitlab::Git::WrapsGitalyErrors
2018-12-23 12:14:25 +05:30
attr_reader :repository, :ref_name, :only_branches_matching, :ssh_key, :known_hosts
def initialize(repository, ref_name, only_branches_matching: [], ssh_key: nil, known_hosts: nil)
2018-03-17 18:26:18 +05:30
@repository = repository
@ref_name = ref_name
2018-12-23 12:14:25 +05:30
@only_branches_matching = only_branches_matching
@ssh_key = ssh_key
@known_hosts = known_hosts
2018-03-17 18:26:18 +05:30
end
2018-12-23 12:14:25 +05:30
def update
2018-12-13 13:39:08 +05:30
wrapped_gitaly_errors do
2018-12-23 12:14:25 +05:30
repository.gitaly_remote_client.update_remote_mirror(
ref_name,
only_branches_matching,
ssh_key: ssh_key,
known_hosts: known_hosts
)
2018-03-17 18:26:18 +05:30
end
end
end
end
end