Skip to content

Commit

Permalink
Enable go-git optimization by default
Browse files Browse the repository at this point in the history
  • Loading branch information
jtibshirani committed Nov 4, 2024
1 parent aa6050a commit 023b5c7
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions gitindex/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,21 +408,20 @@ func indexGitRepo(opts Options, config gitIndexConfig) (bool, error) {
opts.BuildOptions.RepositoryDescription.Source = opts.RepoDir

var repo *git.Repository

// TODO: remove this feature flag once we test this on a large-scale instance.
optimizeRepoOpen := os.Getenv("ZOEKT_ENABLE_GOGIT_OPTIMIZATION")
optimizeRepoOpen := os.Getenv("ZOEKT_DISABLE_GOGIT_OPTIMIZATION")
if b, err := strconv.ParseBool(optimizeRepoOpen); b && err == nil {
repo, err = git.PlainOpen(opts.RepoDir)
if err != nil {
return false, fmt.Errorf("git.PlainOpen: %w", err)
}
} else {
var repoCloser io.Closer
repo, repoCloser, err = openRepo(opts.RepoDir)
if err != nil {
return false, fmt.Errorf("openRepo: %w", err)
}
defer repoCloser.Close()
} else {
repo, err = git.PlainOpen(opts.RepoDir)
if err != nil {
return false, fmt.Errorf("git.PlainOpen: %w", err)
}
}

if err := setTemplatesFromConfig(&opts.BuildOptions.RepositoryDescription, opts.RepoDir); err != nil {
Expand Down

0 comments on commit 023b5c7

Please sign in to comment.