Skip to content

Commit

Permalink
Fix issue where all files were being iterated over when using path fi…
Browse files Browse the repository at this point in the history
…ltering (#2337)
  • Loading branch information
bufdev committed Aug 2, 2023
1 parent dc015c9 commit 986c01c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [Unreleased]

- Fix issue where all files were being iterated over when using the `--path` flag.
- Fix issue where the directory `.` was incorrectly accepted as a value for the
`directories` key in `buf.work.yaml`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,12 @@ func (m *moduleFileSetBuilder) build(

// protoPathsHash returns a hash representing the paths of the .proto files within the Module.
func protoPathsHash(ctx context.Context, module bufmodule.Module) (string, error) {
fileInfos, err := module.SourceFileInfos(ctx)
// Use TargetFileInfos instead of SourceFileInfos as otherwise this will iterate over
// all files in a bucket in the case of using i.e. --path, which causes massive performance problems.
//
// If you are targeting a specific set of files, it's fair to have our duplication detection only
// use target files.
fileInfos, err := module.TargetFileInfos(ctx)
if err != nil {
return "", err
}
Expand Down

0 comments on commit 986c01c

Please sign in to comment.