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

Fix bugs in an earlier attempt to fix "git refs migration".

* kn/reflog-migration-fix-fix:
  refs/reftable: fix uninitialized memory access of `max_index`
  reftable: write correct max_update_index to header
This commit is contained in:
Junio C Hamano
2025-02-03 10:23:34 -08:00
4 changed files with 30 additions and 10 deletions

7
refs.c
View File

@ -1345,6 +1345,13 @@ int ref_transaction_update_reflog(struct ref_transaction *transaction,
update->flags &= ~REF_HAVE_OLD;
update->index = index;
/*
* Reference backends may need to know the max index to optimize
* their writes. So we store the max_index on the transaction level.
*/
if (index > transaction->max_index)
transaction->max_index = index;
return 0;
}