Class: Gollum::Git::Commit

Inherits:
Object
  • Object
show all
Defined in:
lib/grit_adapter/git_layer_grit.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(commit) ⇒ Commit

Returns a new instance of Commit.


81
82
83
# File 'lib/grit_adapter/git_layer_grit.rb', line 81

def initialize(commit)
  @commit = commit
end

Class Method Details

.list_from_string(repo, log) ⇒ Object

Grit::Commit.list_from_string(@wiki.repo, log)


119
120
121
# File 'lib/grit_adapter/git_layer_grit.rb', line 119

def self.list_from_string(repo, log)
  Grit::Commit.list_from_string(repo, log)
end

Instance Method Details

#authorObject


101
102
103
104
# File 'lib/grit_adapter/git_layer_grit.rb', line 101

def author
  author = @commit.author
  Gollum::Git::Actor.new(author.name, author.email)
end

#authored_dateObject


106
107
108
# File 'lib/grit_adapter/git_layer_grit.rb', line 106

def authored_date
  @commit.authored_date
end

#idObject Also known as: sha


85
86
87
# File 'lib/grit_adapter/git_layer_grit.rb', line 85

def id
  @commit.id
end

#messageObject


110
111
112
# File 'lib/grit_adapter/git_layer_grit.rb', line 110

def message
  @commit.message
end

#statsObject


94
95
96
97
98
99
# File 'lib/grit_adapter/git_layer_grit.rb', line 94

def stats
  @stats ||= begin
    grit_stats = @commit.stats
    OpenStruct.new(:additions => grit_stats.additions, :deletions => grit_stats.deletions, :files => grit_stats.files, :id => id, :total => grit_stats.total)
  end
end

#to_sObject


90
91
92
# File 'lib/grit_adapter/git_layer_grit.rb', line 90

def to_s
  @commit.id
end

#treeObject


114
115
116
# File 'lib/grit_adapter/git_layer_grit.rb', line 114

def tree
  Gollum::Git::Tree.new(@commit.tree)
end