Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion cmd/zoekt-git-index/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package main

import (
"encoding/json"
"flag"
"log"
"os"
Expand Down Expand Up @@ -46,6 +47,7 @@ func run() int {
isDelta := flag.Bool("delta", false, "whether we should use delta build")
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).")
metaFile := flag.String("meta", "", "path to .meta JSON file with repository description")

cpuProfile := flag.String("cpu_profile", "", "write cpu profile to `file`")

Expand Down Expand Up @@ -77,6 +79,16 @@ func run() int {
opts := cmd.OptionsFromFlags()
opts.IsDelta = *isDelta

if *metaFile != "" {
data, err := os.ReadFile(*metaFile)
if err != nil {
log.Fatalf("failed to read .meta file %s: %v", *metaFile, err)
}
if err := json.Unmarshal(data, &opts.RepositoryDescription); err != nil {
log.Fatalf("failed to decode .meta file %s: %v", *metaFile, err)
}
}

var branches []string
if *branchesStr != "" {
branches = strings.Split(*branchesStr, ",")
Expand Down Expand Up @@ -121,7 +133,9 @@ func run() int {
profiler.Init("zoekt-git-index")
exitStatus := 0
for dir, name := range gitRepos {
opts.RepositoryDescription.Name = name
if opts.RepositoryDescription.Name == "" {
opts.RepositoryDescription.Name = name
}
gitOpts := gitindex.Options{
BranchPrefix: *branchPrefix,
Incremental: *incremental,
Expand Down
1 change: 1 addition & 0 deletions web/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ type Repository struct {
IndexTime time.Time
Branches []Branch
Files int64
Metadata map[string]string

// Total amount of content bytes.
Size int64
Expand Down
1 change: 1 addition & 0 deletions web/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ func (s *Server) serveListReposErr(q query.Q, qStr string, r *http.Request) (*Re
Size: r.Stats.ContentBytes,
MemorySize: r.Stats.IndexBytes,
Files: int64(r.Stats.Documents),
Metadata: r.Repository.Metadata,
}
for _, b := range r.Repository.Branches {
var buf bytes.Buffer
Expand Down
Loading