Skip to content

Commit

Permalink
Adding methods to tags. related #27
Browse files Browse the repository at this point in the history
  • Loading branch information
robertodecurnex committed Jan 12, 2015
1 parent 13a4d67 commit 0348714
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/git/object.rb
Expand Up @@ -249,11 +249,16 @@ class Tag < AbstractObject
def initialize(base, sha, name)
super(base, sha)
@name = name
@annotated = nil
end

def tag?
true
end

def annotated?
@annotated ||= (@base.lib.object_type(self.name) == 'tag')
end

end

Expand Down
3 changes: 3 additions & 0 deletions tests/units/test_tags.rb
Expand Up @@ -54,6 +54,9 @@ def test_tags
assert_raise Git::GitTagNameDoesNotExist do
r2.tag('third')
end

assert_true(r2.tag('fourth').annotated?)
assert_false(r2.tag('fifth').annotated?)
end
end
end

0 comments on commit 0348714

Please sign in to comment.