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

Configure Feed

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

indexserver: allow public repos in sourcegraphFake (#184)

Also cleaned up the code a bit to make it less verbose and more clear
why it is now correct.

+8 -9
+8 -9
cmd/zoekt-sourcegraph-indexserver/sg.go
··· 259 259 260 260 func (sf sourcegraphFake) getIndexOptions(name string) (IndexOptions, error) { 261 261 dir := filepath.Join(sf.RootDir, filepath.FromSlash(name)) 262 + exists := func(p string) bool { 263 + _, err := os.Stat(filepath.Join(dir, "SG_PRIVATE")) 264 + return err == nil 265 + } 262 266 263 267 opts := IndexOptions{ 264 268 RepoID: fakeID(name), 265 269 Name: name, 266 270 Symbols: true, 271 + 272 + Public: !exists("SG_PRIVATE"), 273 + Fork: exists("SG_FORK"), 274 + Archived: exists("SG_ARCHIVED"), 267 275 } 268 276 269 277 cmd := exec.Command("git", "rev-parse", "HEAD") ··· 278 286 }} 279 287 } 280 288 281 - if _, err := os.Stat(filepath.Join(dir, "SG_PRIVATE")); err == nil { 282 - opts.Public = false 283 - } 284 - if _, err := os.Stat(filepath.Join(dir, "SG_FORK")); err == nil { 285 - opts.Fork = true 286 - } 287 - if _, err := os.Stat(filepath.Join(dir, "SG_ARCHIVED")); err == nil { 288 - opts.Archived = true 289 - } 290 289 return opts, nil 291 290 } 292 291