summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-02-03 10:23:34 -0800
committerJunio C Hamano <gitster@pobox.com>2025-02-03 10:23:35 -0800
commit1f124f30244654fdf3e87efe1b70948fbfeab4b0 (patch)
tree041308ac20aa62f7073f88d70608bb1033aa4946 /refs.c
parentb83a2f9006cdf5293370b1254f4f4cb2770c1b9f (diff)
parentf11f0a5a2db955f68776ea95aec42df7fcb8ce1b (diff)
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
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/refs.c b/refs.c
index 37b8cfb90c..f4094a326a 100644
--- a/refs.c
+++ b/refs.c
@@ -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;
}