-
Notifications
You must be signed in to change notification settings - Fork 4
chore: Add ability to plumb opaque ID into a shard at index time with zoekt-git-index
#6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,7 @@ func run() int { | |
deltaShardNumberFallbackThreshold := flag.Uint64("delta_threshold", 0, "upper limit on the number of preexisting shards that can exist before attempting a delta build (0 to disable fallback behavior)") | ||
languageMap := flag.String("language_map", "", "a mapping between a language and its ctags processor (a:0,b:3).") | ||
tenantID := flag.Int("tenant_id", 0, "tenant ID to use for indexed repositories") | ||
repoID := flag.Uint("repo_id", 0, "opaque ID to use for indexed repositories. Surfaces as `RepositoryID` in the REST search response.") | ||
|
||
cpuProfile := flag.String("cpuprofile", "", "write cpu profile to `file`") | ||
|
||
|
@@ -77,6 +78,7 @@ func run() int { | |
opts := cmd.OptionsFromFlags() | ||
opts.IsDelta = *isDelta | ||
opts.RepositoryDescription.TenantID = *tenantID | ||
opts.RepositoryDescription.ID = uint32(*repoID) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new assignment opts.RepositoryDescription.ID = uint32(*repoID) references *repoID which is not declared or initialized anywhere in the provided context. Please ensure that repoID is declared as a flag or variable and properly parsed before usage. |
||
|
||
var branches []string | ||
if *branchesStr != "" { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -251,8 +251,11 @@ func setTemplatesFromConfig(desc *zoekt.Repository, repoDir string) error { | |
} | ||
} | ||
|
||
id, _ := strconv.ParseUint(sec.Options.Get("repoid"), 10, 32) | ||
desc.ID = uint32(id) | ||
idString := sec.Options.Get("repoid") | ||
if idString != "" { | ||
id, _ := strconv.ParseUint(idString, 10, 32) | ||
desc.ID = uint32(id) | ||
} | ||
Comment on lines
+254
to
+258
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error from strconv.ParseUint is ignored; this could cause silent failures if 'repoid' is malformed. Consider returning or logging the error to handle invalid input gracefully.
Comment on lines
+254
to
+258
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this change needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
![]() Before this change, if |
||
|
||
if desc.RawConfig == nil { | ||
desc.RawConfig = map[string]string{} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new flag
repoID
is added but this flag's value is never used or passed along to indexing options. You should integraterepoID
into the relevant indexing option struct, for example, setting it onopts
orgitOpts.RepositoryDescription
to ensure it takes effect during indexing.