Welcome to mirror list, hosted at ThFree Co, Russian Federation.

remote_mirror.rb « git « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d9f51a7e84446bdd2aa293f0d6260bcd9a1c62f2 (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
# frozen_string_literal: true

module Gitlab
  module Git
    class RemoteMirror
      include Gitlab::Git::WrapsGitalyErrors

      attr_reader :repository, :ref_name, :only_branches_matching, :ssh_key, :known_hosts, :keep_divergent_refs

      def initialize(repository, ref_name, only_branches_matching: [], ssh_key: nil, known_hosts: nil, keep_divergent_refs: false)
        @repository = repository
        @ref_name = ref_name
        @only_branches_matching = only_branches_matching
        @ssh_key = ssh_key
        @known_hosts = known_hosts
        @keep_divergent_refs = keep_divergent_refs
      end

      def update
        wrapped_gitaly_errors do
          repository.gitaly_remote_client.update_remote_mirror(
            ref_name,
            only_branches_matching,
            ssh_key: ssh_key,
            known_hosts: known_hosts,
            keep_divergent_refs: keep_divergent_refs
          )
        end
      end
    end
  end
end