refs/files: fix issues with git-fetch on case-insensitive FS
Hello!
With Git 2.51 we moved 'git-fetch(1)' and 'git-receive-pack(1)' to use batched updates while doing reference updates. This provided a nice perf boost since both commands will now use a single transaction for reference updates. This removes the overhead of using individual transaction per reference update and also avoids unnecessary auto-compaction between reference updates in the reftable backend.
However, in the files-backend it does introduce two bugs when used on a case-insensitive filesystem:
- When fetching references such as:
- refs/heads/foo
- refs/heads/Foo
Earlier we would simply overwrite the first reference with the second, but the fetches would be completed. Now we simply abort stating a conflict.
This is resolved in the first commit by marking this issue as REF_TRANSACTION_ERROR_CREATE_EXISTS. This allows batched updates to mark to mark such conflicts as a rejected update.
- When fetching references such as:
- refs/heads/foo
- refs/heads/Foo/bar
this should be clearly marked as a F/D conflict.
The second commit fixes this by ensuring that on case-insensitive filesystems we lowercase the refnames to ensure F/D are caught and reported to the user.
Sorry for the long wait on this, with the OSSE and Git mini summit last week, I didn't get as much computer time as I wished.
- Karthik