diff --git a/cmd/zoekt-git-index/main.go b/cmd/zoekt-git-index/main.go index 8aff1fbcc..cde395800 100644 --- a/cmd/zoekt-git-index/main.go +++ b/cmd/zoekt-git-index/main.go @@ -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) var branches []string if *branchesStr != "" { diff --git a/gitindex/index.go b/gitindex/index.go index f35af7357..6f30574b0 100644 --- a/gitindex/index.go +++ b/gitindex/index.go @@ -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) + } if desc.RawConfig == nil { desc.RawConfig = map[string]string{}