Module: Gitlab::Git::RuggedImpl::Commit

Extended by:
Utils::Override
Includes:
UseRugged
Included in:
Commit
Defined in:
lib/gitlab/git/rugged_impl/commit.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Methods included from Utils::Override

extended, extensions, included, method_added, override, prepended, queue_verification, verify!

Methods included from UseRugged

#execute_rugged_call, #rugged_enabled_through_feature_flag?, #rugged_feature_keys, #running_puma_with_multiple_threads?, #use_rugged?

Instance Method Details

#commit_tree_entry(path) ⇒ Object


72
73
74
75
76
77
78
# File 'lib/gitlab/git/rugged_impl/commit.rb', line 72

def commit_tree_entry(path)
  if use_rugged?(@repository, :rugged_commit_tree_entry)
    execute_rugged_call(:rugged_tree_entry, path)
  else
    super
  end
end

#init_commit(raw_commit) ⇒ Object


62
63
64
65
66
67
68
69
# File 'lib/gitlab/git/rugged_impl/commit.rb', line 62

def init_commit(raw_commit)
  case raw_commit
  when ::Rugged::Commit
    init_from_rugged(raw_commit)
  else
    super
  end
end

#init_from_rugged(commit) ⇒ Object


95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/gitlab/git/rugged_impl/commit.rb', line 95

def init_from_rugged(commit)
  author = commit.author
  committer = commit.committer

  @raw_commit = commit
  @id = commit.oid
  @message = commit.message
  @authored_date = author[:time]
  @committed_date = committer[:time]
  @author_name = author[:name]
  @author_email = author[:email]
  @committer_name = committer[:name]
  @committer_email = committer[:email]
  @parent_ids = commit.parents.map(&:oid)
  @trailers = Hash[commit.trailers]
end

#rugged_commitObject


87
88
89
90
91
92
93
# File 'lib/gitlab/git/rugged_impl/commit.rb', line 87

def rugged_commit
  @rugged_commit ||= if raw_commit.is_a?(Rugged::Commit)
                       raw_commit
                     else
                       @repository.rev_parse_target(id)
                     end
end

#rugged_tree_entry(path) ⇒ Object

Is this the same as Blob.find_entry_by_path ?


81
82
83
84
85
# File 'lib/gitlab/git/rugged_impl/commit.rb', line 81

def rugged_tree_entry(path)
  rugged_commit.tree.path(path)
rescue Rugged::TreeError
  nil
end