mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-27 22:24:23 +00:00
reflog: rename git_reflog_write() to git_reflog_append()
This commit is contained in:
parent
59341a5d59
commit
d284b3de63
@ -33,7 +33,7 @@ GIT_BEGIN_DECL
|
||||
GIT_EXTERN(int) git_reflog_read(git_reflog **reflog, git_reference *ref);
|
||||
|
||||
/**
|
||||
* Write a new reflog for the given reference
|
||||
* Add a new entry to the reflog for the given reference
|
||||
*
|
||||
* If there is no reflog file for the given
|
||||
* reference yet, it will be created.
|
||||
@ -48,7 +48,7 @@ GIT_EXTERN(int) git_reflog_read(git_reflog **reflog, git_reference *ref);
|
||||
* @param msg the reflog message
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_reflog_write(git_reference *ref, const git_oid *oid_old, const git_signature *committer, const char *msg);
|
||||
GIT_EXTERN(int) git_reflog_append(git_reference *ref, const git_oid *oid_old, const git_signature *committer, const char *msg);
|
||||
|
||||
/**
|
||||
* Rename the reflog for the given reference
|
||||
|
@ -216,7 +216,7 @@ int git_reflog_read(git_reflog **reflog, git_reference *ref)
|
||||
return error;
|
||||
}
|
||||
|
||||
int git_reflog_write(git_reference *ref, const git_oid *oid_old,
|
||||
int git_reflog_append(git_reference *ref, const git_oid *oid_old,
|
||||
const git_signature *committer, const char *msg)
|
||||
{
|
||||
int error;
|
||||
|
@ -36,7 +36,7 @@ void test_refs_reflog_reflog__cleanup(void)
|
||||
|
||||
|
||||
|
||||
void test_refs_reflog_reflog__write_then_read(void)
|
||||
void test_refs_reflog_reflog__append_then_read(void)
|
||||
{
|
||||
// write a reflog for a given reference and ensure it can be read back
|
||||
git_repository *repo2;
|
||||
@ -55,10 +55,10 @@ void test_refs_reflog_reflog__write_then_read(void)
|
||||
|
||||
cl_git_pass(git_signature_now(&committer, "foo", "foo@bar"));
|
||||
|
||||
cl_git_pass(git_reflog_write(ref, NULL, committer, NULL));
|
||||
cl_git_fail(git_reflog_write(ref, NULL, committer, "no ancestor NULL for an existing reflog"));
|
||||
cl_git_fail(git_reflog_write(ref, NULL, committer, "no\nnewline"));
|
||||
cl_git_pass(git_reflog_write(ref, &oid, committer, commit_msg));
|
||||
cl_git_pass(git_reflog_append(ref, NULL, committer, NULL));
|
||||
cl_git_fail(git_reflog_append(ref, NULL, committer, "no ancestor NULL for an existing reflog"));
|
||||
cl_git_fail(git_reflog_append(ref, NULL, committer, "no\nnewline"));
|
||||
cl_git_pass(git_reflog_append(ref, &oid, committer, commit_msg));
|
||||
|
||||
/* Reopen a new instance of the repository */
|
||||
cl_git_pass(git_repository_open(&repo2, "testrepo.git"));
|
||||
@ -94,7 +94,7 @@ void test_refs_reflog_reflog__write_then_read(void)
|
||||
git_reference_free(lookedup_ref);
|
||||
}
|
||||
|
||||
void test_refs_reflog_reflog__dont_write_bad(void)
|
||||
void test_refs_reflog_reflog__dont_append_bad(void)
|
||||
{
|
||||
// avoid writing an obviously wrong reflog
|
||||
git_reference *ref;
|
||||
@ -110,12 +110,12 @@ void test_refs_reflog_reflog__dont_write_bad(void)
|
||||
cl_git_pass(git_signature_now(&committer, "foo", "foo@bar"));
|
||||
|
||||
/* Write the reflog for the new branch */
|
||||
cl_git_pass(git_reflog_write(ref, NULL, committer, NULL));
|
||||
cl_git_pass(git_reflog_append(ref, NULL, committer, NULL));
|
||||
|
||||
/* Try to update the reflog with wrong information:
|
||||
* It's no new reference, so the ancestor OID cannot
|
||||
* be NULL. */
|
||||
cl_git_fail(git_reflog_write(ref, NULL, committer, NULL));
|
||||
cl_git_fail(git_reflog_append(ref, NULL, committer, NULL));
|
||||
|
||||
git_signature_free(committer);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user