Skip to content

fix: recover from invalid cache directory (#70)#82

Merged
simonwhitaker merged 2 commits into
mainfrom
simonwhitaker/issue-70
Apr 20, 2026
Merged

fix: recover from invalid cache directory (#70)#82
simonwhitaker merged 2 commits into
mainfrom
simonwhitaker/issue-70

Conversation

@simonwhitaker
Copy link
Copy Markdown
Owner

Summary

Fixes #70. If a prior clone of the gitignore boilerplate repo was interrupted (e.g. network drop), the cache directory was left behind without a valid git repo inside, so subsequent gibo invocations failed with "repository does not exist" and had no way to recover short of manually deleting the cache.

cloneIfNeeded now verifies the cache dir is a valid git repo via git.PlainOpen, and re-clones if not. Update also now propagates the cloneIfNeeded error instead of discarding it.

Test plan

  • go test ./...
  • Manually reproduced the bug by creating an empty stale cache dir, confirmed gibo update and gibo dump Python both now recover

If a prior clone of the gitignore boilerplate repo was interrupted, the
cache directory was left behind without a valid git repo inside,
causing subsequent gibo invocations to fail. Now detect this state and
re-clone. Also propagate the cloneIfNeeded error from Update.

Fixes #70
Gate the recovery path to git.ErrRepositoryNotExists so that transient
I/O or permission errors don't cause a valid cache to be wiped.
@simonwhitaker simonwhitaker merged commit 732bb19 into main Apr 20, 2026
2 checks passed
@simonwhitaker simonwhitaker deleted the simonwhitaker/issue-70 branch April 20, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gibo 3.0.12 in Windows 11 doesn't work

1 participant