openly-rails
openly-rails copied to clipboard
Selective commits can lead to incorrect backups
When selectively applying changes during new commit, the backup created can be incorrect. A new version will be created, which triggers a new backup request as opposed to taking any existing backup.
Here is what should be done: When selectively committing changes, a backup will definitely already exist for the file. It's just that the backup may not have the right name.
For example, we have two backups:
version 1namedname 1version 2namedname 2
On a selective commit, the user may want version 1 named name 2 OR version 2 named name 1 — neither of which exist in the archive.
Therefore, when creating a new version, ...
- check if backup with same name & content already exists. If so, reuse that.
- check if backup with content already exists (but different time). If so, duplicate that content and assign the new name.
Side note: On selective commit, we should actually disable the ability to create any new backups of remote. It is never needed and if it's happening, then something is going wrong.