fix: respect .gitignore negation patterns when copying project files#3554
Open
PHILLIPS71 wants to merge 2 commits intoexpo:mainfrom
Open
fix: respect .gitignore negation patterns when copying project files#3554PHILLIPS71 wants to merge 2 commits intoexpo:mainfrom
PHILLIPS71 wants to merge 2 commits intoexpo:mainfrom
Conversation
|
Subscribed to pull request
Generated by CodeMention |
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.
Why
.gitignorenegation patterns (e.g..eas/*+!.eas/build/) were not being respected when copying project files. Once a file or directory was marked as ignored, there was no way for a negation rule in the same.gitignoreto un-ignore it. This also affected.gitignorefiles inside dot-directories (e.g..eas/.gitignore), which were never discovered at all.How
Negation support - switched
ignores()from an early-return loop to accumulating state. It now usesignore.test()instead ofignore.ignores()to get bothignoredandunignoredsignals, so a negation rule in the same.gitignoreinstance can override an earlier positive rule.Dot-directory discovery - added
dot: trueto thefast-globcall that finds.gitignorefiles, so files like.eas/.gitignoreare picked up.Directory negation patterns -
node:fsomits trailing slashes from directory paths, so patterns like!build/never matched. The filter now callslstatSyncto detect directories and appends a trailing slash before passing the path toignores(), which correctly distinguishes!build/(directory) from a file namedbuild.Test Plan
Automated tests added in
packages/eas-cli/src/vcs/__tests__/local-test.tscovering:.gitignore!build/not incorrectly un-ignoring a file namedbuild.gitignorefiles inside dot-directories being picked upTo verify manually, add
.eas/*and!.eas/build/to your project's.gitignoreand run a build. The.eas/build/directory should be included in the uploaded archive.