Save snapshots as tags so they don't get deleted by git gc #251
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Creates a new tag for each snapshot hash at
refs/snapshots/<author>/<name>/v<version>
with the tag namesnapshots/<author>/<name>/v<version>
. The tag ref is created outside ofrefs/tags
so that other methods that iterate the refs don't include snapshots in their iterations (i.e.db.authors()
simply returns all nodes inrefs/tags
). It's confirmed that the tag being inrefs/snapshots
still makes it exempt fromgit gc
: without the tag,git gc --prune=all
prunes the snapshot hash, but with the tag it remains aftergit gc --prune=all
.Note: This is an incomplete implementation; it only creates the snapshot tag in
lit add
, not on the server duringlit publish
(or any other places where it might also need to be created)This is the other half of #247
I feel like I'm getting a bit in over my head with this, since I'm not super familiar with the db structure/lit internals/git internals/etc, so I thought I'd push the bit that I've got so far for feedback. As far as I can tell, what needs to be done to finish this up is evaluate/update the other instances of
db.write
throughout the code (rdb.lua, handlers.lua) to also create the snapshot tag.