Navigation Menu

Skip to content
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

Respect --force-exclude for files passed via stdin #1342

Merged
merged 2 commits into from Dec 22, 2022

Conversation

charliermarsh
Copy link
Member

@charliermarsh charliermarsh commented Dec 22, 2022

Resolves #1339.

@charliermarsh
Copy link
Member Author

It turns out that it's very, very hard to use the ignore crate to answer the question, "Is a given path ignored?", because it doesn't seem to expose the underlying matchers, only the directory walkers. This creates a few problems. I'll just leave this comment here for posterity as I roll back some of the code:

// Step 2: Is the file ignored via a gitignore?
// Note that we can't enforce this behavior for non-existent files, which _could_ come up when
// you pass a file via `--stdin-filename`, and _could_ be considered incorrect. For example,
// if `subdir` is listed in the `gitignore`, and you pass `subdir/non_existent_file.py`, then
// right now, we _wouldn't_ mark that theoretical file as ignored. If the `ignore` crate had
// a public matcher API, we could support that, but right now, we _have_ to look at the
// filesystem to reverse-engineer the gitignore match.
// TODO(charlie): This isn't right either, because the _parent_ could be the thing that's
// ignored via the `.gitignore`.

@jhossbach
Copy link

Seems like I was too slow. Also closes #1343

@charliermarsh
Copy link
Member Author

Sadly this doesn't respect gitignore rules in those cases (I tried to get this to work for a while, but I don't think it's reliable without changes to the ignore crate), but otherwise seems to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exclude option ignored when directly calling dir/file
2 participants