From: Han Young <hanyoung@protonmail.com>
In the ref files backend, the symbolic reference name is not checked before an update. This could cause reference and lock files to be created outside the refs/ directory.
Below are the original bug report by Sigma:
$ echo ref: refs/../HEAD > .git/HEAD $ git commit -m "test" --allow-empty fatal: cannot lock ref 'HEAD': Unable to create '/home/sigma/headtest/.git/refs/../HEAD.lock': File exists.
Another git process seems to be running in this repository, e.g. an editor opened by 'git commit'. Please make sure all processes are terminated then try again. If it still fails, a git process may have crashed in this repository earlier: remove the file manually to continue.
In this case, while trying to update the symbolic reference refs/../HEAD, the lock file conflicts with the ./git/HEAD.lock.
If the HEAD points to refs/../foo, a reference file named foo will be created under ./git directory.
Han Young (1): files-backend: check symref name before update
refs/files-backend.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
-- 2.51.0.373.gaf4ee0e35.dirty