Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workspace: make recovery commit empty instead of deleting everything #3149

Merged
merged 1 commit into from
Feb 27, 2024

Conversation

martinvonz
Copy link
Member

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.)

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

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.)
@martinvonz martinvonz merged commit 81e9ba3 into main Feb 27, 2024
15 checks passed
@martinvonz martinvonz deleted the push-lpyzonlvnsuz branch February 27, 2024 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants