Class Gitlab::Git::Commit
In: lib/gitlab_git/commit.rb
Parent: Object

Methods

Included Modules

EncodingHelper

Constants

SERIALIZE_KEYS = [ :id, :message, :parent_ids, :authored_date, :author_name, :author_email, :committed_date, :committer_name, :committer_email

Attributes

head  [RW] 
raw_commit  [RW] 
refs  [RW] 

Public Class methods

Get commits between two revspecs See also repository.commits_between

Ex.

  Commit.between(repo, '29eda46b', 'master')

Returns a diff object for the changes introduced by rugged_commit. If rugged_commit doesn‘t have a parent, then the diff is between this commit and an empty repo. See Repository#diff for the keys allowed in the options hash.

Get single commit

Ex.

  Commit.find(repo, '29eda46b')

  Commit.find(repo, 'master')

Get last commit for HEAD

Ex.

  Commit.last(repo)

Get last commit for specified path and ref

Ex.

  Commit.last_for_path(repo, '29eda46b', 'app/models')

  Commit.last_for_path(repo, 'master', 'Gemfile')

Get commits collection

Ex.

  Commit.where(
    repo: repo,
    ref: 'master',
    path: 'app/models',
    limit: 10,
    offset: 5,
  )

Public Instance methods

Returns a diff object for the changes from this commit‘s first parent. If there is no parent, then the diff is between this commit and an empty repo. See Repository#diff for keys allowed in the options hash.

Was this commit committed by a different person than the original author?

Get ref names collection

Ex.

  commit.ref_names(repo)

Get a collection of Rugged::Reference objects for this commit.

Ex.

  commit.ref(repo)

Shows the diff between the commit‘s parent and the commit.

Cuts out the header and stats from to_patch and returns only the diff.

[Validate]