Gracefully handle case when keep-around references are corrupted or exist already
We were seeing a number of error messages when attempting to create a keep-around ref:
- Failed to create locked file
refs/keep-around/XYZ: File exists
- Failed to write reference
refs/keep-around/XYZ: a reference with that name already exists.
I'm not sure how these happen, but I suspect when multiple workers attempt to write the same file we may have an issue. The force parameter should help ensure the file gets created, as well as the rescues to prevent 500 Errors.
Rugged/libgit2 unfortunately does not allow you to delete or re-create a reference that has been corrupted, even with the force parameter. A truncated reference will stay that way until manual intervention.
Closes #20109 (closed)