refs: allow passing flags when setting up a transaction
Allow passing flags when setting up a transaction such that the behaviour of the transaction itself can be altered. This functionality will be used in a subsequent patch. Adapt callers accordingly. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
facbe4f633
commit
a0efef1446
@ -1252,7 +1252,7 @@ static void prune_ref(struct files_ref_store *refs, struct ref_to_prune *r)
|
||||
if (check_refname_format(r->name, 0))
|
||||
return;
|
||||
|
||||
transaction = ref_store_transaction_begin(&refs->base, &err);
|
||||
transaction = ref_store_transaction_begin(&refs->base, 0, &err);
|
||||
if (!transaction)
|
||||
goto cleanup;
|
||||
ref_transaction_add_update(
|
||||
@ -1396,7 +1396,8 @@ static int files_pack_refs(struct ref_store *ref_store,
|
||||
if (!should_pack_refs(refs, opts))
|
||||
return 0;
|
||||
|
||||
transaction = ref_store_transaction_begin(refs->packed_ref_store, &err);
|
||||
transaction = ref_store_transaction_begin(refs->packed_ref_store,
|
||||
0, &err);
|
||||
if (!transaction)
|
||||
return -1;
|
||||
|
||||
@ -2867,7 +2868,8 @@ static int files_transaction_prepare(struct ref_store *ref_store,
|
||||
*/
|
||||
if (!packed_transaction) {
|
||||
packed_transaction = ref_store_transaction_begin(
|
||||
refs->packed_ref_store, err);
|
||||
refs->packed_ref_store,
|
||||
transaction->flags, err);
|
||||
if (!packed_transaction) {
|
||||
ret = TRANSACTION_GENERIC_ERROR;
|
||||
goto cleanup;
|
||||
@ -3174,7 +3176,8 @@ static int files_initial_transaction_commit(struct ref_store *ref_store,
|
||||
&affected_refnames))
|
||||
BUG("initial ref transaction called with existing refs");
|
||||
|
||||
packed_transaction = ref_store_transaction_begin(refs->packed_ref_store, err);
|
||||
packed_transaction = ref_store_transaction_begin(refs->packed_ref_store,
|
||||
transaction->flags, err);
|
||||
if (!packed_transaction) {
|
||||
ret = TRANSACTION_GENERIC_ERROR;
|
||||
goto cleanup;
|
||||
|
@ -193,6 +193,7 @@ struct ref_transaction {
|
||||
size_t nr;
|
||||
enum ref_transaction_state state;
|
||||
void *backend_data;
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user