Repository navigation
fix: match --git ignore patterns against relative paths - #1437
Merged
schollz merged 1 commit intoNov 12, 2026
Merged
Conversation
gitWalk matched each entry's base name, so directory patterns with a
trailing slash such as "node_modules/" never matched and those folders
were sent with --git. Patterns anchored to the .gitignore ("/dist")
matched at every depth, and patterns with a slash in the middle
("docs/generated/") never matched.
Match the path relative to the .gitignore, with a trailing slash for
directories, and do the same for the paths given on the command line.
schollz
approved these changes
Nov 12, 2026
Owner
|
Thank you! |
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.
croc send --git <folder>matched each entry's base name against the folder's.gitignore, so directory patterns with a trailing slash (node_modules/,build/,__pycache__/) never matched and those folders were sent anyway./distmatched at every depth anddocs/generated/never matched. The zip test even had to usebuildinstead ofbuild/because of this.This matches the path relative to the
.gitignore, with a trailing slash for directories, and does the same for paths given on the command line (croc send --git *).Folder with
main.go,src/app.go,node_modules/pkg/index.jsand.gitignore=node_modules/: beforeSending 4 files and 4 folders, afterSending 3 files and 2 folders. AddedTestGetFilesInfoGitIgnoreDirectoryPatterns(fails onmain:node_modules/pkg/index.jsanddocs/generated/api.mdare sent,lib/dist/keep.jsis dropped), and the zip test now usesbuild/.