Method: Rugged::Object#remove_note
- Defined in:
- ext/rugged/rugged_note.c
permalink #remove_note(data = {}) ⇒ Boolean
Removes a note
from object
, with the given data
arguments, passed as a Hash
:
-
:committer
(optional): a hash with the signature for the committer, defaults to the signature from the configuration -
:author
(optional): a hash with the signature for the author, defaults to the signature from the configuration -
:ref
: (optional): canonical name of the reference to use, defaults to “refs/notes/commits”
When the note is successfully removed true
will be returned as a Boolean
.
= {:email=>"tanoku@gmail.com", :time=>Time.now, :name=>"Vicent Mart\303\255"}
obj.remove_note(
:author => ,
:committer => ,
:ref => 'refs/notes/builds'
)
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
# File 'ext/rugged/rugged_note.c', line 199
static VALUE rb_git_note_remove(int argc, VALUE *argv, VALUE self)
{
int error = 0;
const char *notes_ref = NULL;
git_repository *repo = NULL;
git_signature *author, *committer;
git_object *target = NULL;
VALUE rb_data;
VALUE rb_ref = Qnil;
VALUE rb_author = Qnil;
VALUE rb_committer = Qnil;
VALUE owner;
TypedData_Get_Struct(self, git_object, &rugged_object_type, target);
owner = rugged_owner(self);
Data_Get_Struct(owner, git_repository, repo);
rb_scan_args(argc, argv, "01", &rb_data);
if (!NIL_P(rb_data)) {
Check_Type(rb_data, T_HASH);
rb_ref = rb_hash_aref(rb_data, CSTR2SYM("ref"));
if (!NIL_P(rb_ref)) {
Check_Type(rb_ref, T_STRING);
notes_ref = StringValueCStr(rb_ref);
}
rb_committer = rb_hash_aref(rb_data, CSTR2SYM("committer"));
rb_author = rb_hash_aref(rb_data, CSTR2SYM("author"));
}
committer = rugged_signature_get(rb_committer, repo);
author = rugged_signature_get(rb_author, repo);
error = git_note_remove(
repo,
notes_ref,
author,
committer,
git_object_id(target));
git_signature_free(author);
git_signature_free(committer);
if (error == GIT_ENOTFOUND)
return Qfalse;
rugged_exception_check(error);
return Qtrue;
}
|