git/refs
Karthik Nayak 297c09eabb refs: allow multiple reflog entries for the same refname
The reference transaction only allows a single update for a given
reference to avoid conflicts. This, however, isn't an issue for reflogs.
There are no conflicts to be resolved in reflogs and when migrating
reflogs between backends we'd have multiple reflog entries for the same
refname.

So allow multiple reflog updates within a single transaction. Also the
reflog creation logic isn't exposed to the end user. While this might
change in the future, currently, this reduces the scope of issues to
think about.

In the reftable backend, the writer sorts all updates based on the
update_index before writing to the block. When there are multiple
reflogs for a given refname, it is essential that the order of the
reflogs is maintained. So add the `index` value to the `update_index`.
The `index` field is only set when multiple reflog entries for a given
refname are added and as such in most scenarios the old behavior
remains.

This is required to add reflog migration support to `git refs migrate`.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-12-16 09:45:34 -08:00
..
debug.c Merge branch 'sj/ref-contents-check' 2024-12-04 10:14:42 +09:00
files-backend.c refs: allow multiple reflog entries for the same refname 2024-12-16 09:45:34 -08:00
iterator.c refs: add referent to each_ref_fn 2024-08-09 08:47:34 -07:00
packed-backend.c Merge branch 'sj/ref-contents-check' 2024-12-04 10:14:42 +09:00
packed-backend.h refs/files: use heuristic to decide whether to repack with `--auto` 2024-09-04 08:03:24 -07:00
ref-cache.c ref-cache: fix invalid free operation in `free_ref_entry` 2024-11-27 04:34:37 +09:00
ref-cache.h refs: keep track of unresolved reference value in iterators 2024-08-09 08:47:33 -07:00
refs-internal.h refs: add `committer_info` to `ref_transaction_add_update()` 2024-12-16 09:45:33 -08:00
reftable-backend.c refs: allow multiple reflog entries for the same refname 2024-12-16 09:45:34 -08:00