-
Notifications
You must be signed in to change notification settings - Fork 111
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
fix: use ignore_paths while checking large projects during rill start #5164
Changes from 1 commit
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 |
---|---|---|
|
@@ -11,7 +11,9 @@ import ( | |
"github.com/rilldata/rill/cli/pkg/gitutil" | ||
"github.com/rilldata/rill/cli/pkg/local" | ||
"github.com/rilldata/rill/runtime/compilers/rillv1beta" | ||
"github.com/rilldata/rill/runtime/drivers" | ||
"github.com/spf13/cobra" | ||
"gopkg.in/yaml.v3" | ||
) | ||
|
||
// maxProjectFiles is the maximum number of files that can be in a project directory. | ||
|
@@ -204,18 +206,34 @@ func StartCmd(ch *cmdutil.Helper) *cobra.Command { | |
return startCmd | ||
} | ||
|
||
// a smaller subset of relevant parts of rill.yaml | ||
type rillYAML struct { | ||
IgnorePaths []string `yaml:"ignore_paths"` | ||
} | ||
|
||
func countFilesInDirectory(path string) (int, error) { | ||
var fileCount int | ||
|
||
if path == "" { | ||
path = "." | ||
} | ||
|
||
err := filepath.Walk(path, func(path string, info os.FileInfo, err error) error { | ||
var ignorePaths []string | ||
// Read rill.yaml and get `ignore_paths` | ||
rawYaml, err := os.ReadFile(filepath.Join(path, "/rill.yaml")) | ||
if err == nil { | ||
yml := &rillYAML{} | ||
err = yaml.Unmarshal(rawYaml, yml) | ||
if err == nil { | ||
ignorePaths = yml.IgnorePaths | ||
} | ||
} | ||
|
||
err = filepath.Walk(path, func(path string, info os.FileInfo, err error) error { | ||
if err != nil { | ||
return err | ||
} | ||
if !info.IsDir() { | ||
if !info.IsDir() && drivers.IsIgnored(path, ignorePaths) { | ||
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. is tmp directly added to ignorePaths by default during project initialization? 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. Yes here is the full list: https://github.com/rilldata/rill/blob/main/runtime/drivers/repo.go#L52 |
||
fileCount++ | ||
} | ||
return 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.
Can you change this to
filepath.WalkDir
and returnfilepath.SkipDir
if the path is ignored? So that it doesn't spend time traversing ignored directories.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.
Good point, updated.