This repository has been archived by the owner on Nov 1, 2022. It is now read-only.
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.
To ease the transition into supporting zero git repos, and later supporting more than one repo, this PR moves the periodic
git fetch
loop into the git package.The effect is to make a git repo a state machine; it starts uncloned, then is mirrored, and finally tested to see if it's writable. Treating it as a state machine has a couple of benefits:
This PR doesn't change how the daemon works, in the main -- it will still wait for the repo to be ready before proceeding. To support zero git repos, we can remove that gate and respond to each API method by checking whether there's a git repo ready or not, and acting accordingly.
Tasting notes:
*Repo.Refresh(...)
for when the daemon needs to wait for the repo to be up to date before proceeding.Repo
is a mirror, which means it doesn't have a working directory to look around in; the downside is you have to clone it every time you want to look at the files (a cache could be done in the daemon loop, if necessary). The upside (aside from some convenience in the git operations) is that there's no confusion over which things you can write to -- if you want to make a commit, you have to clone first.