Class: Gitlab::Git::CrossRepoComparer

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/git/cross_repo_comparer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source_repo, target_repo) ⇒ CrossRepoComparer

Returns a new instance of CrossRepoComparer.


8
9
10
11
# File 'lib/gitlab/git/cross_repo_comparer.rb', line 8

def initialize(source_repo, target_repo)
  @source_repo = source_repo
  @target_repo = target_repo
end

Instance Attribute Details

#source_repoObject (readonly)

Returns the value of attribute source_repo


6
7
8
# File 'lib/gitlab/git/cross_repo_comparer.rb', line 6

def source_repo
  @source_repo
end

#target_repoObject (readonly)

Returns the value of attribute target_repo


6
7
8
# File 'lib/gitlab/git/cross_repo_comparer.rb', line 6

def target_repo
  @target_repo
end

Instance Method Details

#compare(source_ref, target_ref, straight:) ⇒ Object


13
14
15
16
17
18
19
20
21
22
# File 'lib/gitlab/git/cross_repo_comparer.rb', line 13

def compare(source_ref, target_ref, straight:)
  ensuring_ref_in_source(target_ref) do |target_commit_id|
    Gitlab::Git::Compare.new(
      source_repo,
      target_commit_id,
      source_ref,
      straight: straight
    )
  end
end