From 13c9e44af9424e1fc478693f0d64fbf7082c9665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Thu, 14 Nov 2013 19:41:09 +0100 Subject: [PATCH] reflog: remove git_reflog_append_to() This was a convenience method for the refs front-end to do the reflog writing. This is now done in the backend and it has no more reason for being. --- include/git2/reflog.h | 19 +------------------ src/reflog.c | 19 ------------------- tests/refs/reflog/reflog.c | 23 ----------------------- 3 files changed, 1 insertion(+), 60 deletions(-) diff --git a/include/git2/reflog.h b/include/git2/reflog.h index 2d1b6eeaa..df06e1b8e 100644 --- a/include/git2/reflog.h +++ b/include/git2/reflog.h @@ -47,7 +47,7 @@ GIT_EXTERN(int) git_reflog_read(git_reflog **out, git_repository *repo, const c GIT_EXTERN(int) git_reflog_write(git_reflog *reflog); /** - * Add a new entry to the reflog. + * Add a new entry to the in-memory reflog. * * `msg` is optional and can be NULL. * @@ -59,23 +59,6 @@ GIT_EXTERN(int) git_reflog_write(git_reflog *reflog); */ GIT_EXTERN(int) git_reflog_append(git_reflog *reflog, const git_oid *id, const git_signature *committer, const char *msg); -/** - * Add a new entry to the named reflog. - * - * This utility function loads the named reflog, appends to it and - * writes it back out to the backend. - * - * `msg` is optional and can be NULL. - * - * @param repo the repository to act on - * @param name the reflog's name - * @param id the OID the reference is now pointing to - * @param committer the signature of the committer - * @param msg the reflog message - * @return 0 or an error code - */ -GIT_EXTERN(int) git_reflog_append_to(git_repository *repo, const char *name, const git_oid *id, const git_signature *committer, const char *msg); - /** * Rename a reflog * diff --git a/src/reflog.c b/src/reflog.c index cebb87d86..9b2b201bf 100644 --- a/src/reflog.c +++ b/src/reflog.c @@ -230,22 +230,3 @@ int git_reflog_drop(git_reflog *reflog, size_t idx, int rewrite_previous_entry) return 0; } - -int git_reflog_append_to(git_repository *repo, const char *name, const git_oid *id, - const git_signature *committer, const char *msg) -{ - int error; - git_reflog *reflog; - - if ((error = git_reflog_read(&reflog, repo, name)) < 0) - return error; - - if ((error = git_reflog_append(reflog, id, committer, msg)) < 0) - goto cleanup; - - error = git_reflog_write(reflog); - -cleanup: - git_reflog_free(reflog); - return error; -} diff --git a/tests/refs/reflog/reflog.c b/tests/refs/reflog/reflog.c index 60085791c..9ac15d556 100644 --- a/tests/refs/reflog/reflog.c +++ b/tests/refs/reflog/reflog.c @@ -100,29 +100,6 @@ void test_refs_reflog_reflog__append_then_read(void) git_signature_free(committer); } -void test_refs_reflog_reflog__append_to_then_read(void) -{ - /* write a reflog for a given reference and ensure it can be read back */ - git_reference *ref; - git_oid oid; - git_signature *committer; - - /* Create a new branch pointing at the HEAD */ - git_oid_fromstr(&oid, current_master_tip); - cl_git_pass(git_reference_create(&ref, g_repo, new_ref, &oid, 0)); - git_reference_free(ref); - - cl_git_pass(git_signature_now(&committer, "foo", "foo@bar")); - - cl_git_fail(git_reflog_append_to(g_repo, new_ref, &oid, committer, "no inner\nnewline")); - cl_git_pass(git_reflog_append_to(g_repo, new_ref, &oid, committer, NULL)); - cl_git_pass(git_reflog_append_to(g_repo, new_ref, &oid, committer, commit_msg "\n")); - - assert_appends(committer, &oid); - - git_signature_free(committer); -} - void test_refs_reflog_reflog__renaming_the_reference_moves_the_reflog(void) { git_reference *master, *new_master;