Merge branch 'kn/reflog-migration-fix-followup'

Code clean-up.

* kn/reflog-migration-fix-followup:
  reftable: prevent 'update_index' changes after adding records
  refs: use 'uint64_t' for 'ref_update.index'
  refs: mark `ref_transaction_update_reflog()` as static
This commit is contained in:
Junio C Hamano
2025-02-14 17:53:48 -08:00
9 changed files with 118 additions and 46 deletions

View File

@@ -179,11 +179,24 @@ int reftable_writer_new(struct reftable_writer **out,
return 0;
}
void reftable_writer_set_limits(struct reftable_writer *w, uint64_t min,
int reftable_writer_set_limits(struct reftable_writer *w, uint64_t min,
uint64_t max)
{
/*
* Set the min/max update index limits for the reftable writer.
* This must be called before adding any records, since:
* - The 'next' field gets set after writing the first block.
* - The 'last_key' field updates with each new record (but resets
* after sections).
* Returns REFTABLE_API_ERROR if called after writing has begun.
*/
if (w->next || w->last_key.len)
return REFTABLE_API_ERROR;
w->min_update_index = min;
w->max_update_index = max;
return 0;
}
static void writer_release(struct reftable_writer *w)