refs: add index field to struct ref_udpate

The reftable backend, sorts its updates by refname before applying them,
this ensures that the references are stored sorted. When migrating
reflogs from one backend to another, the order of the reflogs must be
maintained. Add a new `index` field to the `ref_update` struct to
facilitate this.

This field is used in the reftable backend's sort comparison function
`transaction_update_cmp`, to ensure that indexed fields maintain their
order.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Karthik Nayak
2024-12-16 17:44:27 +01:00
committed by Junio C Hamano
parent 1a83e26d72
commit a3582e2eac
2 changed files with 18 additions and 2 deletions

View File

@ -115,6 +115,13 @@ struct ref_update {
char *msg;
char *committer_info;
/*
* The index overrides the default sort algorithm. This is needed
* when migrating reflogs and we want to ensure we carry over the
* same order.
*/
unsigned int index;
/*
* If this ref_update was split off of a symref update via
* split_symref_update(), then this member points at that