[PATCH v=2 0/1] files-backend: check symref name before update
- From
Han Young <hanyang.tony@bytedance.com>
- Date
- Oct 4, 2025, 14:42 UTC
- Message-ID
- <20251004144223.23436-1-hanyang.tony@bytedance.com>
From: Han Young <hanyoung@protonmail.com>
Following the discussing, I looked into the refs verify and fsck commands. The refs verify command does not check the HEAD ref, fsck checks the HEAD ref name and the commit object it points to.
I think we can move the fsck_head_link from fsck to refs. Then both git fsck and git refs verify can use the same function to check the HEAD ref.
However, there's no harm in adding a runtime check. 'git reset foo' will happily create a ref file outside refs/ and return without error on an invalid HEAD ref.
Change from v1: * add a test in t7102-reset
Han Young (1): files-backend: check symref name before update
refs/files-backend.c | 10 ++++++++++ t/t7102-reset.sh | 8 ++++++++ 2 files changed, 18 insertions(+)
-- 2.51.0.373.g2c26b26d9