Class: Metior::Git::Commit

Inherits:
Commit show all
Defined in:
lib/metior/git/commit.rb

Overview

Represents a commit in a Git source code repository

Author:

  • Sebastian Staudt

Instance Attribute Summary

Attributes inherited from Commit

#author, #authored_date, #children, #committed_date, #committer, #id, #message, #parents, #repo

Instance Method Summary collapse

Methods inherited from Commit

#add_child, #added_files, #additions, #deleted_files, #deletions, #inspect, #load_file_stats, #load_line_stats, #merge?, #modifications, #modified_files, #subject

Methods included from AutoIncludeVCS

included

Constructor Details

#initialize(repo, commit) ⇒ Commit

Creates a new Git commit object linked to the repository and branch it belongs to and the data from the corresponding Grit::Commit object

Parameters:

  • repo (Repository)

    The Git repository this commit belongs to

  • commit (Grit::Commit)

    The commit object from Grit



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/metior/git/commit.rb', line 22

def initialize(repo, commit)
  super repo

  @authored_date  = commit.authored_date
  @committed_date = commit.committed_date
  @id             = commit.id
  @message        = commit.message
  @parents        = commit.parents.map { |parent| parent.id }

  self.author    = commit.author
  self.committer = commit.committer
end