summaryrefslogtreecommitdiff
path: root/include/git2/reflog.h
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-07-16 18:31:22 +0200
committernulltoken <emeric.fermas@gmail.com>2012-07-25 07:53:29 +0200
commit59341a5d5960b13801404d3690f6bcf27e91efa6 (patch)
tree389aac6eab46d25593902f64a626db698ad6f26d /include/git2/reflog.h
parent7c458e3aee7b39bfec368456d494972fe9ae244b (diff)
downloadlibgit2-59341a5d5960b13801404d3690f6bcf27e91efa6.tar.gz
reflog: introduce git_reflog_entry_drop()
Diffstat (limited to 'include/git2/reflog.h')
-rw-r--r--include/git2/reflog.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/git2/reflog.h b/include/git2/reflog.h
index 8acba349b..7467e81ed 100644
--- a/include/git2/reflog.h
+++ b/include/git2/reflog.h
@@ -87,6 +87,26 @@ GIT_EXTERN(unsigned int) git_reflog_entrycount(git_reflog *reflog);
GIT_EXTERN(const git_reflog_entry *) git_reflog_entry_byindex(git_reflog *reflog, unsigned int idx);
/**
+ * Remove an entry from the reflog by its index
+ *
+ * To ensure there's no gap in the log history, set the `rewrite_previosu_entry` to 1.
+ * When deleting entry `n`, member old_oid of entry `n-1` (if any) will be updated with
+ * the value of memeber new_oid of entry `n+1`.
+ *
+ * @param reflog a previously loaded reflog.
+ *
+ * @param idx the position of the entry to remove.
+ *
+ * @param rewrite_previous_entry 1 to rewrite the history; 0 otherwise.
+ *
+ * @return 0 on success or an error code.
+ */
+GIT_EXTERN(int) git_reflog_entry_drop(
+ git_reflog *reflog,
+ unsigned int idx,
+ int rewrite_previous_entry);
+
+/**
* Get the old oid
*
* @param entry a reflog entry