fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

Feature flag ctags metadata generation

+31 -11
+9
build/builder.go
··· 68 68 // SubRepositories is a path => sub repository map. 69 69 SubRepositories map[string]*zoekt.Repository 70 70 71 + // DisableCTags disables the generation of ctags metadata. 72 + DisableCTags bool 73 + 71 74 // Path to exuberant ctags binary to run 72 75 CTags string 73 76 ··· 91 94 hasher.Write([]byte(fmt.Sprintf("%t", o.CTagsMustSucceed))) 92 95 hasher.Write([]byte(fmt.Sprintf("%d", o.SizeMax))) 93 96 hasher.Write([]byte(fmt.Sprintf("%q", o.LargeFiles))) 97 + hasher.Write([]byte(fmt.Sprintf("%t", o.DisableCTags))) 94 98 95 99 return fmt.Sprintf("%x", hasher.Sum(nil)) 96 100 } ··· 239 243 finishedShards: map[string]string{}, 240 244 } 241 245 246 + if b.opts.DisableCTags { 247 + b.opts.CTags = "" 248 + } 249 + 242 250 if b.opts.CTags == "" && b.opts.CTagsMustSucceed { 243 251 return nil, fmt.Errorf("ctags binary not found, but CTagsMustSucceed set") 244 252 } ··· 251 259 252 260 b.parser = parser 253 261 } 262 + 254 263 if _, err := b.newShardBuilder(); err != nil { 255 264 return nil, err 256 265 }
+10 -8
cmd/flags.go
··· 38 38 } 39 39 40 40 var ( 41 - sizeMax = flag.Int("file_limit", 128*1024, "maximum file size") 42 - trigramMax = flag.Int("max_trigram_count", 20000, "maximum number of trigrams per document") 43 - shardLimit = flag.Int("shard_limit", 100<<20, "maximum corpus size for a shard") 44 - parallelism = flag.Int("parallelism", 4, "maximum number of parallel indexing processes.") 45 - indexDir = flag.String("index", build.DefaultDir, "directory for search indices") 46 - version = flag.Bool("version", false, "Print version number") 47 - ctags = flag.Bool("require_ctags", false, "If set, ctags calls must succeed.") 48 - largeFiles = largeFilesFlag{} 41 + sizeMax = flag.Int("file_limit", 128*1024, "maximum file size") 42 + trigramMax = flag.Int("max_trigram_count", 20000, "maximum number of trigrams per document") 43 + shardLimit = flag.Int("shard_limit", 100<<20, "maximum corpus size for a shard") 44 + parallelism = flag.Int("parallelism", 4, "maximum number of parallel indexing processes.") 45 + indexDir = flag.String("index", build.DefaultDir, "directory for search indices") 46 + version = flag.Bool("version", false, "Print version number") 47 + disableCTags = flag.Bool("disable_ctags", false, "If set, ctags will not be called.") 48 + ctags = flag.Bool("require_ctags", false, "If set, ctags calls must succeed.") 49 + largeFiles = largeFilesFlag{} 49 50 ) 50 51 51 52 func init() { ··· 64 65 SizeMax: *sizeMax, 65 66 ShardMax: *shardLimit, 66 67 IndexDir: *indexDir, 68 + DisableCTags: *disableCTags, 67 69 CTagsMustSucceed: *ctags, 68 70 LargeFiles: largeFiles, 69 71 TrigramMax: *trigramMax,
+9 -1
cmd/zoekt-sourcegraph-indexserver/main.go
··· 141 141 // LargeFiles is a slice of glob patterns where matching files are 142 142 // indexed regardless of their size. 143 143 LargeFiles []string 144 + 145 + // Symbols is a boolean that indicates whether to generate ctags metadata or not 146 + Symbols bool 144 147 } 145 148 146 149 func (o *IndexOptions) toArgs() []string { 147 - args := make([]string, 0, len(o.LargeFiles)*2) 150 + args := make([]string, 0, len(o.LargeFiles)*2+1) 151 + if o.Symbols { 152 + args = append(args, "-require_ctags") 153 + } else { 154 + args = append(args, "-disable_ctags") 155 + } 148 156 for _, a := range o.LargeFiles { 149 157 args = append(args, "-large_file", a) 150 158 }
+3 -2
toc.go
··· 27 27 // 13: content checksums 28 28 // 14: languages 29 29 // 15: rune based symbol sections 30 - // 16: store ctags metadata 30 + // 16: ctags metadata 31 31 const IndexFormatVersion = 16 32 32 33 33 // FeatureVersion is increased if a feature is added that requires reindexing data ··· 39 39 // 6: Include '#' into the LineFragment template 40 40 // 7: Record skip reasons in the index. 41 41 // 8: Record source path in the index. 42 - const FeatureVersion = 8 42 + // 9: Store ctags metadata 43 + const FeatureVersion = 9 43 44 44 45 type indexTOC struct { 45 46 fileContents compoundSection