repository: Cleanup stale lockfiles when running housekeeping
This MR moves much of our cleanup logic which is currently part of the Cleanup RPC into the houskeeping package and starts to call housekeeping.Perform
in Cleanup. This unifies some of the logic across GarbageCollect, object pool cleanups and the Cleanup RPC:
- stale lockfiles for config, commit-graph, HEAD
- stale lockfiles for loose references
- packed-refs.lock and packed-refs.new
This should enable users to recover from some repository corruption state caused by such files by enabling them to execute "Run housekeeping", which will now remove such leftover files after a grace period.
Part of #3335 (closed)