Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
workspace: make recovery commit empty instead of deleting everything
The recovery commit we create when we run into a stale working copy with a missing operation currently has an empty tree. Our commit backend at Google creates an index of which files changed in each commit. That gets really expensive when a commit deletes all files in the repo, as these recovery commits do. So for our backend, it is much better to make the recovery commit empty instead. That's what this patch does. It almost doesn't matter functionally what tree we use for it since we don't care much about the current tree when snapshotting the working copy. It does matter in a few cases, however. One case is for conflicts. In that case, it's likely better to use the recovery commit's parent as base tree (as we do by making the recovery commit empty) than to use an empty tree, as that would guarantee that all conflicts would be considered resolved. (Side note: perhaps we should start looking at the current commit's parent instead of looking at the current commit when snapshotting, but that's a topic for another day.)
- Loading branch information