-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Expected Behavior
The user's ~/.rvcs/archive directory only maintains the history that the user still cares about, and does not require an excessive amount of additional storage versus the user's actual file contents.
Actual Behavior
The user's ~/.rvcs/archive directory grows without bounds and contains full copies of every version of every file tracked.
Steps to Reproduce the Problem
To reproduce the issue of the directory growing without bound:
- Create a temporary directory
- Create a file within that directory
- Snapshot that file (but not the containing directory)
- Delete that file
- Snapshot the (now empty) temporary directory
- The snapshot of the now-deleted file will not be reachable from the snapshot of the directory, but it will also never be garbage collected.
To reproduce the issue of a full copy of every version of every file being retained:
- Create a temporary file
- Add some text to it
- Snapshot the file
- Add a single character to the end of the file
- Snapshot the file again
- There will be two separate entries under
~/.rvcs/archive/objects/for the contents of the two different versions of the file which differ by only one character.
One way that we could fix both issues would be to add something like a rvcs cleanup command that would do the following:
- Traverse all of the paths under
~/.rvcs/archive/paths/, and find all of the objects reachable from those paths - Add all of those reachable objects to a zip file stored under the
~/.rvcs/archive/directory - Remove the now-zipped objects from the
~/.rvcs/archive/objects/directory - Remove any objects from
~/.rvcs/archive/objects/that were not reachable from any of the paths - Similarly remove any entries from
~/.rvcs/archive/paths/and~/.rvcs/archive/cachethat do not correspond to any currently mapped paths
For the last two steps, we would need to take extra care to make sure that we do not have any race conditions with simultaneous runs of the rvcs snapshot or rvcs merge commands.
Additionally, we would need to extend the tool to be able to read objects from the zip file under the ~/.rvcs/archive/ directory if they are not in the ~/.rvcs/archive/objects/ directory.