Class: Git::TagInfo
- Inherits:
-
Data
- Object
- Data
- Git::TagInfo
- Defined in:
- lib/git/tag_info.rb
Overview
Value object representing tag metadata from git tag output
This is a lightweight, immutable data structure returned by tag listing commands. It contains only the data parsed from git output without any repository context or operations.
The tagger identity is a nested AuthorInfo. Its date is a Time
parsed from git's strict ISO 8601 output, not an ISO 8601 string.
Instance Attribute Summary collapse
-
#message ⇒ String?
readonly
The tag message, or nil for lightweight tags.
-
#name ⇒ String
readonly
The tag name (e.g., 'v1.0.0').
-
#objecttype ⇒ String
readonly
'tag' for annotated tags, 'commit' for lightweight tags.
-
#oid ⇒ String?
readonly
The object ID of the tag object itself.
-
#tagger ⇒ Git::AuthorInfo?
readonly
The identity of the person who created the tag object.
-
#target_oid ⇒ String
readonly
The object ID of the commit this tag ultimately points to.
Instance Method Summary collapse
-
#annotated? ⇒ Boolean
True if this is an annotated tag (oid is present).
-
#lightweight? ⇒ Boolean
True if this is a lightweight tag (oid is nil).
Instance Attribute Details
#message ⇒ String? (readonly)
Returns the tag message, or nil for lightweight tags.
88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/git/tag_info.rb', line 88 TagInfo = Data.define(:name, :oid, :target_oid, :objecttype, :tagger, :message) do # @return [Boolean] true if this is an annotated tag (oid is present) def annotated? !oid.nil? end # @return [Boolean] true if this is a lightweight tag (oid is nil) def lightweight? oid.nil? end end |
#name ⇒ String (readonly)
Returns the tag name (e.g., 'v1.0.0').
88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/git/tag_info.rb', line 88 TagInfo = Data.define(:name, :oid, :target_oid, :objecttype, :tagger, :message) do # @return [Boolean] true if this is an annotated tag (oid is present) def annotated? !oid.nil? end # @return [Boolean] true if this is a lightweight tag (oid is nil) def lightweight? oid.nil? end end |
#objecttype ⇒ String (readonly)
Returns 'tag' for annotated tags, 'commit' for lightweight tags.
88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/git/tag_info.rb', line 88 TagInfo = Data.define(:name, :oid, :target_oid, :objecttype, :tagger, :message) do # @return [Boolean] true if this is an annotated tag (oid is present) def annotated? !oid.nil? end # @return [Boolean] true if this is a lightweight tag (oid is nil) def lightweight? oid.nil? end end |
#oid ⇒ String? (readonly)
The object ID of the tag object itself.
For annotated tags, this is the tag object's ID. For lightweight tags, this is nil because lightweight tags are not objects in the git database.
88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/git/tag_info.rb', line 88 TagInfo = Data.define(:name, :oid, :target_oid, :objecttype, :tagger, :message) do # @return [Boolean] true if this is an annotated tag (oid is present) def annotated? !oid.nil? end # @return [Boolean] true if this is a lightweight tag (oid is nil) def lightweight? oid.nil? end end |
#tagger ⇒ Git::AuthorInfo? (readonly)
The identity of the person who created the tag object.
Lightweight tags have no tag object and therefore no tagger. The nested
email has no angle brackets and the nested date is a Time.
88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/git/tag_info.rb', line 88 TagInfo = Data.define(:name, :oid, :target_oid, :objecttype, :tagger, :message) do # @return [Boolean] true if this is an annotated tag (oid is present) def annotated? !oid.nil? end # @return [Boolean] true if this is a lightweight tag (oid is nil) def lightweight? oid.nil? end end |
#target_oid ⇒ String (readonly)
The object ID of the commit this tag ultimately points to.
For both annotated and lightweight tags, this is the commit ID that the tag resolves to (i.e., the dereferenced target).
88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/git/tag_info.rb', line 88 TagInfo = Data.define(:name, :oid, :target_oid, :objecttype, :tagger, :message) do # @return [Boolean] true if this is an annotated tag (oid is present) def annotated? !oid.nil? end # @return [Boolean] true if this is a lightweight tag (oid is nil) def lightweight? oid.nil? end end |
Instance Method Details
#annotated? ⇒ Boolean
Returns true if this is an annotated tag (oid is present).
90 91 92 |
# File 'lib/git/tag_info.rb', line 90 def annotated? !oid.nil? end |
#lightweight? ⇒ Boolean
Returns true if this is a lightweight tag (oid is nil).
95 96 97 |
# File 'lib/git/tag_info.rb', line 95 def lightweight? oid.nil? end |