diff options
author | Patrick Steinhardt <ps@pks.im> | 2022-01-17 11:12:31 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-01-17 22:01:44 +0300 |
commit | 69840cc0f7b4f3352903bd2b8f3de7077916c26b (patch) | |
tree | 76b4f1d477d6ee9dbc04daade90d9be9ffe328e8 /refs/packed-backend.h | |
parent | e83ba647f7c61cf945690d6a0bd8c172a6498dc8 (diff) |
refs: extract packed_refs_delete_refs() to allow control of transaction
When deleting loose refs, then we also have to delete the refs in the
packed backend. This is done by calling `refs_delete_refs()`, which
then uses the packed-backend's logic to delete refs. This doesn't allow
us to exercise any control over the reference transaction which is being
created in the packed backend, which is required in a subsequent commit.
Extract a new function `packed_refs_delete_refs()`, which hosts most of
the logic to delete refs except for creating the transaction itself.
Like this, we can easily create the transaction in the files backend
and thus exert more control over it.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs/packed-backend.h')
-rw-r--r-- | refs/packed-backend.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/refs/packed-backend.h b/refs/packed-backend.h index f61a73ec25..a2cca5d9a3 100644 --- a/refs/packed-backend.h +++ b/refs/packed-backend.h @@ -3,6 +3,7 @@ struct repository; struct ref_transaction; +struct string_list; /* * Support for storing references in a `packed-refs` file. @@ -27,6 +28,12 @@ int packed_refs_lock(struct ref_store *ref_store, int flags, struct strbuf *err) void packed_refs_unlock(struct ref_store *ref_store); int packed_refs_is_locked(struct ref_store *ref_store); +int packed_refs_delete_refs(struct ref_store *ref_store, + struct ref_transaction *transaction, + const char *msg, + struct string_list *refnames, + unsigned int flags); + /* * Return true if `transaction` really needs to be carried out against * the specified packed_ref_store, or false if it can be skipped |