3 class GitTagNameDoesNotExist< StandardError
9 attr_accessor :sha, :size, :type, :mode
13 def initialize(base, sha)
16 @size = @base.lib.object_size(@sha)
21 @base.lib.object_contents(@sha)
25 self.contents.split("\n")
29 raise NotImplementedError
36 def grep(string, path_limiter = nil, opts = {})
37 default = {:object => @sha, :path_limiter => path_limiter}
38 grep_options = default.merge(opts)
39 @base.lib.grep(string, grep_options)
43 Git::Diff.new(@base, @sha, objectish)
47 Git::Log.new(@base, count).object(@sha)
53 class Blob < AbstractObject
59 class Tree < AbstractObject
65 class Commit < AbstractObject
84 Tree.new(@base, @tree)
91 # array of all parent commits
116 alias_method :date, :committer_date
124 # see if this object has been initialized and do so if not
126 data = @base.lib.commit_data(@sha)
127 @committer = Git::Author.new(data['committer'])
128 @author = Git::Author.new(data['author'])
129 @tree = Tree.new(@base, data['tree'])
130 @parents = data['parent'].map{ |sha| Commit.new(@base, sha) }
131 @message = data['message'].chomp
136 class Tag < AbstractObject
139 def initialize(base, sha, name)
150 # if we're calling this, we don't know what type it is yet
151 # so this is our little factory method
152 def new(base, objectish, is_tag = false)
154 sha = base.lib.tag_sha(objectish)
156 raise Git::GitTagNameDoesNotExist.new(objectish)
158 return Tag.new(base, sha, objectish)
160 sha = base.lib.revparse(objectish)
161 type = base.lib.object_type(sha)
167 when /commit/: Commit
170 klass::new(base, sha)