Stop a blank line in .ignore from excluding the whole Edge App - #321
Open
rusko124 wants to merge 2 commits into
Open
Stop a blank line in .ignore from excluding the whole Edge App#321rusko124 wants to merge 2 commits into
rusko124 wants to merge 2 commits into
Conversation
An empty line became the pattern ^$, and walkdir yields the root directory itself with an empty relative path, so filter_entry pruned the entire tree before it was walked. A deploy then collected zero files and the server rejected it with "index.html is required". Any editor that leaves a trailing newline produced this. Blank lines are now skipped, and the walk root is exempt from the ignore rules so no future pattern can prune everything the same way.
There was a problem hiding this comment.
🔵 Needs a closer look
Directory ignore patterns ending with / still won’t match/prune the directory entry itself in filter_entry, causing potentially expensive descent into ignored trees (e.g., node_modules).
Pull request overview
Fixes a deploy-breaking edge case where blank/whitespace-only lines in .ignore could produce an empty regex (^$) that matched the walk root and caused WalkDir::filter_entry to prune the entire directory tree, resulting in zero collected upload files.
Changes:
- Skip blank (and whitespace-only)
.ignorelines when building ignore patterns to avoid generating an empty-match regex. - Ensure the walk root (depth 0) is always included so the traversal cannot be pruned at the root by any ignore match.
- Add/adjust tests to cover
.ignorefiles containing blank lines during both ignore parsing and file collection.
File summaries
| File | Description |
|---|---|
src/commands/ignorer.rs |
Skips empty/whitespace-only .ignore lines and adds a regression test for blank-line behavior. |
src/commands/edge_app/utils.rs |
Prevents WalkDir root pruning by always including depth-0 entries; updates ignore-related test data to include blank lines. |
Review details
Suppressed comments (1)
src/commands/ignorer.rs:29
- Directory patterns (lines ending with
/) compile to a regex that requires a trailing slash (e.g.,^node_modules/.*$), butWalkDirdirectory entries are represented without a trailing slash (e.g.,node_modules). This means ignored directories won’t be pruned byfilter_entry, and the walk will still descend into large trees likenode_modules, skipping files one-by-one (potentially very slow). Consider matching both the directory entry itself and everything under it.
if pattern.ends_with('/') {
patterns.push(format!("^{}.*$", regex::escape(pattern)));
} else if pattern.contains('*') {
// Convert wildcard '*' to regex '.*'
let converted = pattern.replace('.', r"\.").replace('*', r".*");
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A blank line in
.ignorebecame the regex pattern^$.collect_paths_for_uploadwalks withWalkDir::new(root).filter_entry(is_included), and walkdir yields the root directory itself as the first entry —Ignorer::is_ignoredstrips the base path off it, leaving the empty string, which^$matches. Rejecting a directory infilter_entryprunes its whole subtree, so the walk ended before it started and the deploy collected zero files. The server then rejects the deploy withindex.html is required.Any editor that leaves a trailing newline on the file produces this, so it is easy to hit and gives no hint where the problem is. A single trailing
\nis harmless —str::linesyields no empty item for it — but\n\nis enough.Two changes:
is_includedexempts the walk root, so no future pattern that happens to match the empty string can prune the whole tree again.