Class: MergeRequests::LinkLfsObjectsService

Inherits:
BaseProjectService show all
Defined in:
app/services/merge_requests/link_lfs_objects_service.rb

Instance Attribute Summary

Attributes inherited from BaseProjectService

#project

Attributes inherited from BaseContainerService

#container, #current_user, #params

Instance Method Summary collapse

Methods inherited from BaseProjectService

#initialize

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Methods inherited from BaseContainerService

#group_container?, #initialize, #namespace_container?, #project_container?

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

This class inherits a constructor from BaseProjectService

Instance Method Details

#execute(merge_request, oldrev: merge_request.diff_base_sha, newrev: merge_request.diff_head_sha) ⇒ Object


5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/services/merge_requests/link_lfs_objects_service.rb', line 5

def execute(merge_request, oldrev: merge_request.diff_base_sha, newrev: merge_request.diff_head_sha)
  return if merge_request.source_project == project
  return if no_changes?(oldrev, newrev)

  new_lfs_oids = lfs_oids(merge_request.source_project.repository, oldrev, newrev)

  return if new_lfs_oids.empty?

  Projects::LfsPointers::LfsLinkService
    .new(project)
    .execute(new_lfs_oids)
end