diff options
author | Ben Straub <bs@github.com> | 2013-10-28 06:20:28 -0700 |
---|---|---|
committer | Ben Straub <bs@github.com> | 2013-10-28 06:20:28 -0700 |
commit | 8f4a8b096ba35a2af3f9c51dad7e0402790b58ac (patch) | |
tree | 80a707dd35672be1f88506c04058b7fad9947fa6 /include/git2/reflog.h | |
parent | a1efa5960d8f874b92403d875bf08a22c7be2437 (diff) | |
parent | 0174794a955dbec1e2d9ecf581833fc23c7e844c (diff) | |
download | libgit2-8f4a8b096ba35a2af3f9c51dad7e0402790b58ac.tar.gz |
Merge pull request #1802 from libgit2/cmn/reflog-backend
Make reflog part of refdb
Diffstat (limited to 'include/git2/reflog.h')
-rw-r--r-- | include/git2/reflog.h | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/include/git2/reflog.h b/include/git2/reflog.h index 4944530af..2d1b6eeaa 100644 --- a/include/git2/reflog.h +++ b/include/git2/reflog.h @@ -31,10 +31,11 @@ GIT_BEGIN_DECL * git_reflog_free(). * * @param out pointer to reflog - * @param ref reference to read the reflog for + * @param repo the repostiory + * @param name reference to look up * @return 0 or an error code */ -GIT_EXTERN(int) git_reflog_read(git_reflog **out, const git_reference *ref); +GIT_EXTERN(int) git_reflog_read(git_reflog **out, git_repository *repo, const char *name); /** * Write an existing in-memory reflog object back to disk @@ -59,26 +60,45 @@ 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); /** - * Rename the reflog for the given reference + * 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 * * The reflog to be renamed is expected to already exist * * The new name will be checked for validity. * See `git_reference_create_symbolic()` for rules about valid names. * - * @param ref the reference - * @param name the new name of the reference + * @param repo the repository + * @param old_name the old name of the reference + * @param new_name the new name of the reference * @return 0 on success, GIT_EINVALIDSPEC or an error code */ -GIT_EXTERN(int) git_reflog_rename(git_reference *ref, const char *name); +GIT_EXTERN(int) git_reflog_rename(git_repository *repo, const char *old_name, const char *name); /** * Delete the reflog for the given reference * - * @param ref the reference + * @param repo the repository + * @param name the reflog to delete * @return 0 or an error code */ -GIT_EXTERN(int) git_reflog_delete(git_reference *ref); +GIT_EXTERN(int) git_reflog_delete(git_repository *repo, const char *name); /** * Get the number of log entries in a reflog |