mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-28 10:28:56 +00:00
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.
This commit is contained in:
parent
a57dd3b7a4
commit
13c9e44af9
@ -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
|
||||
*
|
||||
|
19
src/reflog.c
19
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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user