gitindex: diff config updates for existing clones#1019
Merged
keegancsmith merged 1 commit intomainfrom Mar 23, 2026
Merged
Conversation
Member
Author
|
Sorry vibe coded this change and the agent decided to go ahead and open a PR before I had reviewed / improved anything |
This supersedes #635 by porting its selective config-sync idea onto current main with a smaller, easier-to-read shape. Clone orchestration stays in gitindex/clone.go, while config argument generation and existing-clone sync logic now live in gitindex/clone_config.go. For existing clones, we now diff each zoekt.* setting before writing. Unchanged values are skipped, changed values are updated, and settings that disappear are removed. CloneRepo returns the repo destination only when a setting change actually happened so the caller can trigger reindexing only when needed. cmd/zoekt-mirror-github was also cleaned up so optional integer metadata keys are only added to the config map when present, which avoids pushing empty config values downstream. Note: On #635 review it mentioned using go-git. This commit initially explored that but it ended up being a _lot_ more code due to missing utilities around easily setting values based on a git config string.
8d9c128 to
c3ad93d
Compare
burmudar
reviewed
Mar 23, 2026
| if !ok { | ||
| return false, nil | ||
| } | ||
| if err := unsetRepoConfigValue(repoDest, key); err != nil { |
Contributor
There was a problem hiding this comment.
what are the chances of there already being a key with an empty value?
Member
Author
There was a problem hiding this comment.
Sorry missed this comment.
it was a previous bug that we would marshal the empty string here. So this does clean it up. In practice though I don't think it happened for the zoekt use cases.
burmudar
approved these changes
Mar 23, 2026
Contributor
burmudar
left a comment
There was a problem hiding this comment.
pretty straight forward 🚀
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.
This supersedes #635 by porting its selective config-sync idea onto current main with a smaller, easier-to-read shape. Clone orchestration stays in gitindex/clone.go, while config argument generation and existing-clone sync logic now live in gitindex/clone_config.go.
For existing clones, we now diff each zoekt.* setting before writing. Unchanged values are skipped, changed values are updated, and settings that disappear are removed. CloneRepo returns the repo destination only when a setting change actually happened so the caller can trigger reindexing only when needed.
cmd/zoekt-mirror-github was also cleaned up so optional integer metadata keys are only added to the config map when present, which avoids pushing empty config values downstream.
Note: On #635 review it mentioned using go-git. This commit initially explored that but it ended up being a lot more code due to missing utilities around easily setting values based on a git config string.