Class: Grit::Tag
Instance Attribute Summary
Attributes inherited from Ref
#commit, #name
Class Method Summary
collapse
Methods inherited from Ref
#initialize, #inspect
Constructor Details
This class inherits a constructor from Grit::Ref
Class Method Details
.commit_from_sha(repo, id) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/grit/tag.rb', line 13
def self.commit_from_sha(repo, id)
git_ruby_repo = GitRuby::Repository.new(repo.path)
object = git_ruby_repo.get_object_by_sha1(id)
if object.type == :commit
Commit.create(repo, :id => id)
elsif object.type == :tag
Commit.create(repo, :id => object.object)
else
raise "Unknown object type."
end
end
|
.find_all(repo, options = {}) ⇒ Object
4
5
6
7
8
9
10
11
|
# File 'lib/grit/tag.rb', line 4
def self.find_all(repo, options = {})
refs = repo.git.refs(options, prefix)
refs.split("\n").map do |ref|
name, id = *ref.split(' ')
commit = commit_from_sha(repo, id)
self.new(name, commit)
end
end
|