Repository navigation
feat(cli): add a git-bug cache rebuild command - #1633
Open
davicbtoliveira wants to merge 3 commits into
Open
davicbtoliveira wants to merge 3 commits into
davicbtoliveira wants to merge 3 commits into
Conversation
NewRepoCacheRebuild takes the repository lock, drops the cache on disk and rebuilds it from the git data, so that changes made to git-bug's references by other tools are picked up. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adds a `cache` command with a `rebuild` subcommand, and groups `cache` and `wipe` under a new "Maintenance" help group. Refs git-bug#1420 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sub-caches build concurrently and each writes its excerpts as soon as it succeeds, so a failure in one left the others on disk. Remove them all, so a failed build leaves nothing to load. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
I appreciate the help, but this is unlikely to be merged. I'm working at the moment on making the cache detect/repair a mismatch with the data on disk (for a lot of reasons), which should make that need of exposing this to the user obsolete. I'll keep the PR around for now, in the case where there is still some need after I'm done. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Refs #1420
The cache doesn't notice changes made to
refs/bugs/*andrefs/identities/*by other tools (plaingit fetch/push,git bundlerestore,git update-ref -d), so git-bug keeps showing deleted bugs and misses fetched ones until.git/git-bug/cacheis removed by hand (see discussion #1332 and #1583).This adds a supported way to do that:
Changes
cache:NewRepoCacheRebuildtakes the repository lock, drops the cache on disk and rebuilds excerpts and indexes from the git data. It refuses, without touching anything, if another process holds the lock. It only reads refs and never modifies git data or config.cache: when a build fails, every excerpt file is removed (sub-caches build concurrently and used to leave the successful ones on disk), so the next open rebuilds instead of loading a partial cache.commands: newcachecommand with arebuildsubcommand, following the noun/action pattern ofdoc/design/cli-convention.md.commands:cacheandwipeare grouped under a new "Maintenance" help group. This is my take on the "root namespace for admin things" suggested in add new command to refresh the cache #1420: grouping in the help output without changing the path ofwipe. Happy to adjust the naming if you prefer something else (e.g.reset <target>).Out of scope
wipebuilding a cache just to remove it) and cache update on push in hosting situation #409 (live invalidation with the webui running).Tests
go test ./cache/... ./commands/.... New tests cover refs removed, restored or moved outside git-bug; rebuild refused while the repo is locked; a failed rebuild leaving no excerpts and the next open rebuilding; argument validation; and the help grouping.