repository: Use locking two-phase voting when deleting gitattributes
The ApplyGitattributes RPC is responsible for writing the
.gitattributes
file from a given revision into the repository's
info/attributes
file such that its attributes are available when
performing various actions. As a special case, when there is no such
file, then the RPC will delete the file in the repository, too.
While the case where we write the gitattributes file into the repository properly locks the destination and performs voting on it, the case where it is being removed doesn't. As a result, two conflicting RPC calls may easily race with each other and thus lead to undefined mixed results.
Fix this by locking the file before removing it and by using proper two-phase voting.
Changelog: fixed
Part of #3709 (closed)