From b7c93a66e2410298fe846b9ed18a70b4d0ace45e Mon Sep 17 00:00:00 2001 From: schu Date: Mon, 21 Nov 2011 13:01:40 +0100 Subject: Add git_reflog_rename() and git_reflog_delete() Signed-off-by: schu --- include/git2/reflog.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include/git2') diff --git a/include/git2/reflog.h b/include/git2/reflog.h index 9ad42b73..f1d08795 100644 --- a/include/git2/reflog.h +++ b/include/git2/reflog.h @@ -50,6 +50,23 @@ GIT_EXTERN(int) git_reflog_read(git_reflog **reflog, git_reference *ref); */ GIT_EXTERN(int) git_reflog_write(git_reference *ref, const git_oid *oid_old, const git_signature *committer, const char *msg); +/** + * Rename the reflog for the given reference + * + * @param ref the reference + * @param new_name the new name of the reference + * @return GIT_SUCCESS or an error code + */ +GIT_EXTERN(int) git_reflog_rename(git_reference *ref, const char *new_name); + +/** + * Delete the reflog for the given reference + * + * @param ref the reference + * @return GIT_SUCCESS or an error code + */ +GIT_EXTERN(int) git_reflog_delete(git_reference *ref); + /** * Get the number of log entries in a reflog * -- cgit v1.2.1 From a5cd086dffbc07ad839f3a9c320dda6970594126 Mon Sep 17 00:00:00 2001 From: schu Date: Mon, 21 Nov 2011 11:56:00 +0100 Subject: reference_rename: don't delete the reflog reference_rename used to delete an old reflog file when renaming a reference to not confuse git.git. Don't do this anymore but let the user take care of writing a reflog entry. Signed-off-by: schu --- include/git2/refs.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/git2') diff --git a/include/git2/refs.h b/include/git2/refs.h index 82c5d888..32671aa6 100644 --- a/include/git2/refs.h +++ b/include/git2/refs.h @@ -183,6 +183,11 @@ GIT_EXTERN(int) git_reference_set_oid(git_reference *ref, const git_oid *id); * If the `force` flag is not enabled, and there's already * a reference with the given name, the renaming will fail. * + * IMPORTANT: + * The user needs to write a proper reflog entry if the + * reflog is enabled for the repository. We only rename + * the reflog if it exists. + * * @param ref The reference to rename * @param new_name The new name for the reference * @param force Overwrite an existing reference -- cgit v1.2.1