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

branch_commit_resolver.rb « resolvers « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4f6062a47812f935dadaa1284ab1fc7e02b35d60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

module Resolvers
  class BranchCommitResolver < BaseResolver
    type Types::CommitType, null: true

    alias_method :branch, :object

    def resolve(**args)
      return unless branch

      commit = branch.dereferenced_target
      project = Project.find_by_full_path(commit.repository.gl_project_path)

      ::Commit.new(commit, project) if commit
    end
  end
end