refs: new transaction related ref-store api
The transaction struct now takes a ref store at creation and will operate on that ref store alone. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
7d2df051d0
commit
c0fe4e8ba3
9
refs.h
9
refs.h
@ -333,6 +333,10 @@ int reflog_exists(const char *refname);
|
||||
* exists, regardless of its old value. It is an error for old_sha1 to
|
||||
* be NULL_SHA1. flags is passed through to ref_transaction_delete().
|
||||
*/
|
||||
int refs_delete_ref(struct ref_store *refs, const char *msg,
|
||||
const char *refname,
|
||||
const unsigned char *old_sha1,
|
||||
unsigned int flags);
|
||||
int delete_ref(const char *msg, const char *refname,
|
||||
const unsigned char *old_sha1, unsigned int flags);
|
||||
|
||||
@ -418,6 +422,8 @@ enum action_on_err {
|
||||
* Begin a reference transaction. The reference transaction must
|
||||
* be freed by calling ref_transaction_free().
|
||||
*/
|
||||
struct ref_transaction *ref_store_transaction_begin(struct ref_store *refs,
|
||||
struct strbuf *err);
|
||||
struct ref_transaction *ref_transaction_begin(struct strbuf *err);
|
||||
|
||||
/*
|
||||
@ -552,6 +558,9 @@ void ref_transaction_free(struct ref_transaction *transaction);
|
||||
* ref_transaction_update(). Handle errors as requested by the `onerr`
|
||||
* argument.
|
||||
*/
|
||||
int refs_update_ref(struct ref_store *refs, const char *msg, const char *refname,
|
||||
const unsigned char *new_sha1, const unsigned char *old_sha1,
|
||||
unsigned int flags, enum action_on_err onerr);
|
||||
int update_ref(const char *msg, const char *refname,
|
||||
const unsigned char *new_sha1, const unsigned char *old_sha1,
|
||||
unsigned int flags, enum action_on_err onerr);
|
||||
|
||||
Reference in New Issue
Block a user