Class: Git::Object::Tag Deprecated
- Inherits:
-
AbstractObject
- Object
- AbstractObject
- Git::Object::Tag
- Defined in:
- lib/git/object.rb
Overview
Use Repository::ObjectOperations#tag_list and TagInfo instead
TagInfo is an immutable value object carrying the tag's name,
oid, target_oid, annotated?, message, and tagger. Call the
corresponding Repository method (e.g. archive, log, diff,
cat_file_contents) with info.oid || info.target_oid for operations
on a tag; that is the object this class resolves and pins at
construction, so a later move of the tag does not redirect an existing
object, whereas the tag name would. Constructing a Git::Object::Tag
emits a deprecation warning.
A Git tag object
This class represents a tag in Git, which can be either annotated or lightweight.
Annotated tags contain additional metadata such as the tagger's name, email, and the date when the tag was created, along with a message.
Instance Attribute Summary collapse
-
#name ⇒ String
The tag name.
Attributes inherited from AbstractObject
#mode, #objectish, #size, #type
Instance Method Summary collapse
-
#annotated? ⇒ Boolean
Returns whether this tag is annotated.
-
#initialize(base, sha, name = nil) ⇒ Tag
constructor
A new instance of Tag.
-
#message ⇒ String?
Returns the tag message.
-
#tag? ⇒ Boolean
Returns whether this object is a tag.
-
#tagger ⇒ Git::AuthorInfo?
Returns the tagger identity.
Methods inherited from AbstractObject
#archive, #blob?, #commit?, #contents, #contents_array, #diff, #grep, #log, #sha, #to_s, #tree?
Constructor Details
#initialize(base, name) ⇒ Tag #initialize(base, sha, name) ⇒ Tag
Returns a new instance of Tag.
579 580 581 582 583 584 585 586 587 588 589 590 |
# File 'lib/git/object.rb', line 579 def initialize(base, sha, name = nil) Git::Deprecation.warn( 'Git::Object::Tag is deprecated and will be removed in v6.0.0. ' \ 'Use Git::Repository#tag_list and Git::TagInfo instead.' ) sha, name = resolve_sha_and_name(base, sha, name) super(base, sha) @name = name @annotated = nil @loaded = false end |
Instance Attribute Details
#name ⇒ String
Returns the tag name.
556 557 558 |
# File 'lib/git/object.rb', line 556 def name @name end |
Instance Method Details
#annotated? ⇒ Boolean
Returns whether this tag is annotated
596 597 598 |
# File 'lib/git/object.rb', line 596 def annotated? @annotated = @annotated.nil? ? (object_repository.cat_file_type(name) == 'tag') : @annotated end |
#message ⇒ String?
Returns the tag message
605 606 607 608 |
# File 'lib/git/object.rb', line 605 def check_tag @message end |
#tag? ⇒ Boolean
Returns whether this object is a tag
614 615 616 |
# File 'lib/git/object.rb', line 614 def tag? true end |
#tagger ⇒ Git::AuthorInfo?
Returns the tagger identity
623 624 625 626 |
# File 'lib/git/object.rb', line 623 def tagger check_tag @tagger end |