const char *log_message)
{
- git_reflog *reflog = NULL;
git_oid peeled_ref_oid;
int error;
- if ((error = git_reflog_read(&reflog, ref)) < 0)
- goto cleanup;
-
if ((error = git_reference_name_to_id(&peeled_ref_oid,
git_reference_owner(ref), git_reference_name(ref))) < 0)
- goto cleanup;
-
- if ((error = git_reflog_append(reflog, &peeled_ref_oid,
- signature, log_message)) < 0)
- goto cleanup;
-
- error = git_reflog_write(reflog);
-
-cleanup:
- git_reflog_free(reflog);
+ return error;
- return 0;
+ return git_reflog_append_to(git_reference_owner(ref), git_reference_name(ref),
+ &peeled_ref_oid, signature, log_message);
}
static int reference__create(
cl_git_pass(
git_reference_create_with_log(&reference, g_repo, name, &id, 0, signature, message));
- cl_git_pass(git_reflog_read(&reflog, reference));
+ cl_git_pass(git_reflog_read(&reflog, g_repo, name));
cl_assert_equal_sz(1, git_reflog_entrycount(reflog));
entry = git_reflog_entry_byindex(reflog, 0);
cl_git_pass(git_reference_symbolic_create_with_log(&reference, g_repo,
name, current_head_target, 0, signature, message));
- cl_git_pass(git_reflog_read(&reflog, reference));
+ cl_git_pass(git_reflog_read(&reflog, g_repo, name));
cl_assert_equal_sz(1, git_reflog_entrycount(reflog));
entry = git_reflog_entry_byindex(reflog, 0);
cl_git_pass(git_reference_set_target_with_log(
&reference_out, reference, &target_id, signature, message));
- cl_git_pass(git_reflog_read(&reflog, reference_out));
+ cl_git_pass(git_reflog_read(&reflog, g_repo, br2_name));
entry = git_reflog_entry_byindex(reflog, 0);
cl_assert(git_oid_cmp(¤t_id, &entry->oid_old) == 0);
cl_assert_equal_s(
br2_name, git_reference_symbolic_target(reference_out));
- cl_git_pass(git_reflog_read(&reflog, reference));
+ cl_git_pass(git_reflog_read(&reflog, g_repo, name));
entry = git_reflog_entry_byindex(reflog, 0);
cl_assert(git_oid_streq(&entry->oid_old, master_tip) == 0);