RepositoryService: implement Cleanup
This is not a rewrapping of
git clean. Rather, this relies on
git worktree remove and
git worktree prune.
These are similar to the temporary working directories we're using on the server side with
hg share. See
man git-worktree for more information.
This method is low priority because:
- our Mercurial shares are automatically removed after use (but we could later on reuse them with a pool for performance reasons on large repositories). Also their creation is currently entirely managed from the Rails app, so it would be consistent to perform any cleanup of them from the same place, namely
Git::Repositoryrescues the call if it fails