[PATCH 0/8] refs: fix migration of reflog entries
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jul 22, 2025, 11:20 UTC
- Message-ID
- <20250722-pks-reflog-append-v1-0-183e5949de16@pks.im>
Hi,
after the announcement that "reftable" will become the default backend in Git 3.0 I've revived the efforts to implement this backend in libgit2. I'm happy to report that this implementation is almost done by now: out of 3000 tests only four are failing now.
For two of these tests I have been completely puzzled why those are failing, as everything really looked perfectly fine in libgit2. As it turned out, the bug wasn't in libgit2 though, but in Git. Namely, the way we migrate reflog entries between storage formats is broken in two ways:
- The identity we write into the reflog entries is wrong.
- The old commit ID of reflog entries is always set to all-zeroes.
This is what caused the libgit2 tests to fail, as I used `git refs
migrate` to convert test repositories to use reftables.This patch series fixes both of these issues. Furthermore, it also adds a new `git reflog write` subcommand to write new reflog entries for a specific reference. This command was helpful to reproduce some test constellations in libgit2.
Thanks!
Patrick
---
Patrick Steinhardt (8):
Documentation/git-reflog: convert to use synopsis type
builtin/reflog: improve grouping of subcommands
refs: export `ref_transaction_update_reflog()`
builtin/reflog: implement subcommand to write new entries
ident: fix type of string length parameter
refs: fix identity for migrated reflogs
refs: stop unsetting REF_HAVE_OLD for log-only updates
refs: fix invalid old object IDs when migrating reflogsDocumentation/git-reflog.adoc | 17 +++---- builtin/reflog.c | 103 ++++++++++++++++++++++++++++++++++-------- ident.c | 2 +- ident.h | 2 +- refs.c | 58 +++++++++++++----------- refs.h | 24 +++++++++- refs/files-backend.c | 25 ++++++++-- refs/reftable-backend.c | 26 +++++++---- t/meson.build | 1 + t/t1421-reflog-write.sh | 81 +++++++++++++++++++++++++++++++++ t/t1460-refs-migrate.sh | 22 ++++++--- 11 files changed, 283 insertions(+), 78 deletions(-)
--- base-commit: 3f2a94875d2f41fe4758a439f68d8b73cfb19d0f change-id: 20250722-pks-reflog-append-634172d8ab2c