Skip to content

Commit

Permalink
Pass BuildOptions directly
Browse files Browse the repository at this point in the history
  • Loading branch information
jtibshirani committed Nov 15, 2023
1 parent 852058d commit 8562dda
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions gitindex/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ func indexGitRepo(opts Options, config gitIndexConfig) error {
keys := fileKeys[name]

for _, key := range keys {
doc, err := createDocument(key, repos, branchMap, ranks, opts)
doc, err := createDocument(key, repos, branchMap, ranks, opts.BuildOptions)
if err != nil {
return err
}
Expand Down Expand Up @@ -860,23 +860,21 @@ func prepareNormalBuild(options Options, repository *git.Repository) (repos map[
return repos, branchMap, branchVersions, nil
}

func createDocument(
key fileKey,
func createDocument(key fileKey,
repos map[fileKey]BlobLocation,
branchMap map[fileKey][]string,
ranks repoPathRanks,
opts Options,
opts build.Options,
) (zoekt.Document, error) {
blob, err := repos[key].Repo.BlobObject(key.ID)
if err != nil {
return zoekt.Document{}, err
}

keyFullPath := key.FullPath()

if blob.Size > int64(opts.BuildOptions.SizeMax) && !opts.BuildOptions.IgnoreSizeMax(keyFullPath) {
if blob.Size > int64(opts.SizeMax) && !opts.IgnoreSizeMax(keyFullPath) {
return zoekt.Document{
SkipReason: fmt.Sprintf("file size %d exceeds maximum size %d", blob.Size, opts.BuildOptions.SizeMax),
SkipReason: fmt.Sprintf("file size %d exceeds maximum size %d", blob.Size, opts.SizeMax),
Name: key.FullPath(),
Branches: branchMap[key],
SubRepositoryPath: key.SubRepoPath,
Expand Down

0 comments on commit 8562dda

Please sign in to comment.