diff options
author | Karthik Nayak <karthik.188@gmail.com> | 2025-01-23 12:29:44 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2025-01-23 09:56:22 -0800 |
commit | 3519492430ba26cadcdb215730a6c8e1bcf5b9cf (patch) | |
tree | 22f8a3ceb3c9d740e2e2c3133fc471f1af3799b9 /diff.c | |
parent | 8ddcdc1bb33ccf803461dd2365146f9341bf9312 (diff) |
refs: fix creation of reflog entries for symrefs
The commit 297c09eabb (refs: allow multiple reflog entries for the
same refname, 2024-12-16) added logic to exit early in
`lock_ref_for_update()` after obtaining the required lock. This was
added as a performance optimization on a false assumption that no
further processing was required for reflog-only updates.
However the assumption was wrong. For a symref's reflog entry, the
update needs to be populated with the old_oid value, but the early
exit skipped this necessary step.
This caused a bug in Git 2.48 in the files backend where target
references of symrefs being updated would create a corrupted reflog
entry for the symref since the old_oid is not populated.
Everything the early exit skipped in the code path is necessary for
both regular and symbolic ref, so eliminate the mistaken
optimization, and also add a test to ensure that such an issue
doesn't arise in the future.
Reported-by: Nika Layzell <nika@thelayzells.com>
Co-authored-by: Jeff King <peff@peff.net>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
0 files changed, 0 insertions, 0 deletions