Class: Rugged::Tag::Annotation

Inherits:
RuggedObject
  • Object
show all
Defined in:
lib/rugged/tag.rb,
ext/rugged/rugged_tag.c

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.prettify_message(msg, strip_comments = true) ⇒ Object



8
9
10
# File 'lib/rugged/tag.rb', line 8

def self.prettify_message(msg, strip_comments = true)
  Rugged::prettify_message(msg, strip_comments)
end

Instance Method Details

#inspectObject



12
13
14
# File 'lib/rugged/tag.rb', line 12

def inspect
  "#<Rugged::Tag::Annotation:#{object_id} {name: #{name.inspect}, message: #{message.inspect}, target: #{target.inspect}>"
end

#messageObject

Return the message of this tag annotation. This includes the full body of the message and any optional footers or signatures after it.

annotation.message #=> "Release v0.16.0, codename 'broken stuff'"


151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'ext/rugged/rugged_tag.c', line 151

static VALUE rb_git_tag_annotation_message(VALUE self)
{
	git_tag *tag;
	const char *message;

	Data_Get_Struct(self, git_tag, tag);
	message = git_tag_message(tag);

	if (!message)
		return Qnil;

	return rb_str_new_utf8(message);
}

#modify(new_args, force = True) ⇒ Object



25
26
27
28
# File 'lib/rugged/tag.rb', line 25

def modify(new_args, force=True)
  args = self.to_hash.merge(new_args)
  Tag.create(args, force)
end

#nameObject

Return a string with the name of this tag annotation.

annotation.name #=> "v0.16.0"


110
111
112
113
114
115
116
# File 'ext/rugged/rugged_tag.c', line 110

static VALUE rb_git_tag_annotation_name(VALUE self)
{
	git_tag *tag;
	Data_Get_Struct(self, git_tag, tag);

	return rb_str_new_utf8(git_tag_name(tag));
}

#taggerObject

Return the signature for the author of this tag annotation. The signature is returned as a Hash containing :name, :email of the author and :time of the tagging.

annotation.tagger #=> {:email=>"[email protected]", :time=>Tue Jan 24 05:42:45 UTC 2012, :name=>"Vicent Mart\303\255"}


128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'ext/rugged/rugged_tag.c', line 128

static VALUE rb_git_tag_annotation_tagger(VALUE self)
{
	git_tag *tag;
	const git_signature *tagger;

	Data_Get_Struct(self, git_tag, tag);
	tagger = git_tag_tagger(tag);

	if (!tagger)
		return Qnil;

	return rugged_signature_new(tagger, NULL);
}

#targetObject

Return the object pointed at by this tag annotation, as a Rugged::Object instance.

annotation.target #=> #<Rugged::Commit:0x108828918>

Returns:



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'ext/rugged/rugged_tag.c', line 44

static VALUE rb_git_tag_annotation_target(VALUE self)
{
	git_tag *tag;
	git_object *target;
	int error;
	VALUE owner;

	Data_Get_Struct(self, git_tag, tag);
	owner = rugged_owner(self);

	error = git_tag_target(&target, tag);
	rugged_exception_check(error);

	return rugged_object_new(owner, target);
}

#target_oidObject #target_idObject

Return the oid pointed at by this tag annotation, as a String instance.

annotation.target_id #=> "2cb831a8aea28b2c1b9c63385585b864e4d3bad1"


70
71
72
73
74
75
76
77
78
79
80
# File 'ext/rugged/rugged_tag.c', line 70

static VALUE rb_git_tag_annotation_target_id(VALUE self)
{
	git_tag *tag;
	const git_oid *target_oid;

	Data_Get_Struct(self, git_tag, tag);

	target_oid = git_tag_target_id(tag);

	return rugged_create_oid(target_oid);
}

#target_oidObject #target_idObject

Return the oid pointed at by this tag annotation, as a String instance.

annotation.target_id #=> "2cb831a8aea28b2c1b9c63385585b864e4d3bad1"


70
71
72
73
74
75
76
77
78
79
80
# File 'ext/rugged/rugged_tag.c', line 70

static VALUE rb_git_tag_annotation_target_id(VALUE self)
{
	git_tag *tag;
	const git_oid *target_oid;

	Data_Get_Struct(self, git_tag, tag);

	target_oid = git_tag_target_id(tag);

	return rugged_create_oid(target_oid);
}

#typeObject

Return a symbol representing the type of the objeced pointed at by this annotation. Possible values are :blob, :commit, :tree and :tag.

This is always the same as the type of the returned annotation.target

annotation.type #=> :commit
annotation.target.type == annotation.type #=> true


94
95
96
97
98
99
100
# File 'ext/rugged/rugged_tag.c', line 94

static VALUE rb_git_tag_annotation_target_type(VALUE self)
{
	git_tag *tag;
	Data_Get_Struct(self, git_tag, tag);

	return rugged_otype_new(git_tag_target_type(tag));
}

#to_hashObject



16
17
18
19
20
21
22
23
# File 'lib/rugged/tag.rb', line 16

def to_hash
  {
    :message => message,
    :name => name,
    :target => target,
    :tagger => tagger,
  }
end