-
Notifications
You must be signed in to change notification settings - Fork 587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose option to scan without indexing #3360
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,16 +21,17 @@ import ( | |
var _ source.Source = (*directorySource)(nil) | ||
|
||
type Config struct { | ||
Path string | ||
Base string | ||
Exclude source.ExcludeConfig | ||
Alias source.Alias | ||
Path string | ||
Base string | ||
Exclude source.ExcludeConfig | ||
Alias source.Alias | ||
Unindexed bool | ||
} | ||
|
||
type directorySource struct { | ||
id artifact.ID | ||
config Config | ||
resolver *fileresolver.Directory | ||
resolver file.Resolver | ||
mutex *sync.Mutex | ||
} | ||
|
||
|
@@ -145,12 +146,15 @@ func (s *directorySource) FileResolver(_ source.Scope) (file.Resolver, error) { | |
// this should be the only file resolver that might have overlap with where files are cached | ||
exclusionFunctions = append(exclusionFunctions, excludeCachePathVisitors()...) | ||
|
||
res, err := fileresolver.NewFromDirectory(s.config.Path, s.config.Base, exclusionFunctions...) | ||
if err != nil { | ||
return nil, fmt.Errorf("unable to create directory resolver: %w", err) | ||
if s.config.Unindexed { | ||
s.resolver = fileresolver.NewFromRootedUnindexedDirectory(s.config.Path, s.config.Base) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we'll need to modify this resolver to accept exclusions -- I think it would be surprising to users to have different exclusion behavior based off of changing only an index related configuration. If this is too difficult or infeasible then we should at least warn the user with |
||
} else { | ||
res, err := fileresolver.NewFromDirectory(s.config.Path, s.config.Base, exclusionFunctions...) | ||
if err != nil { | ||
return nil, fmt.Errorf("unable to create directory resolver: %w", err) | ||
} | ||
s.resolver = res | ||
} | ||
|
||
s.resolver = res | ||
} | ||
|
||
return s.resolver, nil | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we expose a CLI option for this? I feel like this is more of a low-level option, which hints at leaving it only in the config (and overridable via env vars too).