Improve handling of erroneous dirty library repo state after release checkout #42
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.
Even though in theory it shouldn't ever be necessary to do a hard reset in this application, under certain circumstances, go-git can fail to complete checkout, while not even returning an error (go-git/go-git#99). The resulting dirty repository state would cause Library Manager to serve a corrupted release. A hard reset after each checkout ensures that the repository is at its tagged state.
The previous checkout behavior resulted in the ssd1306@1.0.0 release being indexed, even though the repository contains a
.exe
file at that tag:https://github.com/lexus2k/ssd1306/tree/v1.0.0/tools
By chance, this incomplete checkout removed the
.exe
file from the release, which allowed it to pass validation. Although harmless in this particular case, incomplete checkouts could cause big problems if essential files went missing from releases, and so must be avoided, by recovering when possible, and skipping the release when not possible.