Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In git 2.48.1, the `git update-ref` subcommand no longer correctly updates the reflog in some cases. Specifically, it appears that the `old_oid` field will not be updated when modifying a branch referenced by another symbolic ref (e.g. HEAD). This doesn't break the `git reflog` subcommand, but does break references like `HEAD@{1}`, which appear to read the `old_oid` field: git init -b main git commit --allow-empty -m "A" git commit --allow-empty -m "B" git update-ref -m "reason" refs/heads/main HEAD~ HEAD The `old_oid` field is now empty (all zeroes). This is only the case in derived reflogs (in this case .git/logs/HEAD). The reflog for `refs/heads/main` appears to be updated correctly. This was broken in 297c09e (refs: allow multiple reflog entries for the same refname, 2024-12-16). The reason for that was that there was assumed the flow of `lock_ref_for_update()` for reflog only updates was to capture the lock only. But this is wrong since this misses the `old_oid` population. As such this patch is the correct fix. Reported-by: Nika Layzell <[email protected]> Acked-by: Karthik Nayak <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
- Loading branch information