Method: Rugged::Reference#log
- Defined in:
- ext/rugged/rugged_reference.c
#log ⇒ Array
Return an array with the log of all modifications to this reference
Each reflog_entry is a hash with the following keys:
-
:id_old: previous OID before the change -
:id_new: OID after the change -
:committer: author of the change -
:message: message for the change
Example:
reference.log #=> [
# {
# :id_old => nil,
# :id_new => '9d09060c850defbc7711d08b57def0d14e742f4e',
# :committer => {:name => 'Vicent Marti', :email => {'[email protected]'}},
# :message => 'created reference'
# }, ... ]
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
# File 'ext/rugged/rugged_reference.c', line 285
static VALUE rb_git_reflog(VALUE self)
{
git_reflog *reflog;
git_reference *ref;
int error;
VALUE rb_log;
size_t i, ref_count;
Data_Get_Struct(self, git_reference, ref);
error = git_reflog_read(&reflog, git_reference_owner(ref), git_reference_name(ref));
rugged_exception_check(error);
ref_count = git_reflog_entrycount(reflog);
rb_log = rb_ary_new2(ref_count);
for (i = 0; i < ref_count; ++i) {
const git_reflog_entry *entry =
git_reflog_entry_byindex(reflog, ref_count - i - 1);
rb_ary_push(rb_log, reflog_entry_new(entry));
}
git_reflog_free(reflog);
return rb_log;
}
|