OpenBagTwo / gsb

A tool for managing incremental backups of your save states using Git!
https://openbagtwo.github.io/gsb/
GNU General Public License v3.0
0 stars 0 forks source link

Backup history proof of concept #17

Closed OpenBagTwo closed 1 year ago

OpenBagTwo commented 1 year ago

Summary

Addresses #4, save for the CLI

List of Changes

Tech Debt and Other Concerns

Timestamp resolution means tests need to sleep

It appears that Git itself only resolves timestamps to the second, which means that I'm having to put in a sleep to test the operation of the since kwarg.

This is mitigated in 9f7242cabfba348d062ef128952bb208a3c28c6f via use of pytest's tmp_path_factory fixture to make it so that the git repo needs to be created only once. This is a pattern that should be used sparingly but is safe in this case because gsb history does not make any changes.

Explicitly note that this does not affect the ordering of commits--that is guaranteed by the linear history and the fact that we're walking through the commits one at a time

author time or commit time?

Looking over the git history, I was surprised it didn't go back farther. Then I remembered that I'd done a bunch of rebasing and realized it was probably using the date of the rebase.

In actuality, I just misread the timestamps, but it did clue me into the fact that I have to be very intentional about whether this line:

https://github.com/OpenBagTwo/gsb/blob/d5874a072329e010a91987b62ab5095486465e28/gsb/_git.py#L257

uses commit.commit_time (the time of the squash or cherry-pick) vs. commit.author.time, which is the time the original commit was made.

What I want is to use the time the last commit was made, but I don't think that's recoverable, so it just needs to be noted in #9 that squashing needs to preserve the last date.

Validation Performed

PR Type

Checklist: