Comments (5)
Why not just whitelist the files you want to search in your ~/.rgignore
? e.g., !a*
.
(I think I had the same problem as you, so I just put !*
in my $HOME/.rgignore
, which whitelists anything that would otherwise be ignored by $HOME/.gitignore
.)
from ripgrep.
Before whitelisting:
km²~/temp/:proj> rg foo --debug 09/24 1:26am
DEBUG:grep::search: regex ast:
Literal {
chars: [
'f',
'o',
'o'
],
casei: false
}
DEBUG:grep::literals: literal prefixes detected: Literals { lits: [Complete(foo)], limit_size: 250, limit_class: 10 }
DEBUG:rg::ignore: ./SOMEPRJ/abc ignored by Pattern { from: "/home/kmodi/.gitignore", original: "a*", pat: "**/a*", whitelist: false, only_dir: false }
DEBUG:rg::ignore: ./SOMEPRJ/ghi ignored by Pattern { from: "/home/kmodi/.gitignore", original: "g*", pat: "**/g*", whitelist: false, only_dir: false }
DEBUG:rg::ignore: ./SOMEPRJ/.rgignore ignored because it is hidden
No files were searched, which means ripgrep probably applied a filter you didn't expect. Try running again with --debug.
After whitelisting by add !*
to the very top of ~/.rgignore
:
km²~/temp/:proj> rg foo --debug 09/24 1:31am
DEBUG:grep::search: regex ast:
Literal {
chars: [
'f',
'o',
'o'
],
casei: false
}
DEBUG:grep::literals: literal prefixes detected: Literals { lits: [Complete(foo)], limit_size: 250, limit_class: 10 }
DEBUG:rg::ignore: ./SOMEPRJ whitelisted by Pattern { from: "/home/kmodi/.rgignore", original: "!*", pat: "**/*", whitelist: true, only_dir: false }
DEBUG:rg::ignore: ./SOMEPRJ/abc whitelisted by Pattern { from: "/home/kmodi/.rgignore", original: "!*", pat: "**/*", whitelist: true, only_dir: false }
DEBUG:rg::ignore: ./SOMEPRJ/abc/def whitelisted by Pattern { from: "/home/kmodi/.rgignore", original: "!*", pat: "**/*", whitelist: true, only_dir: false }
DEBUG:rg::ignore: ./SOMEPRJ/abc/def/XXX whitelisted by Pattern { from: "/home/kmodi/.rgignore", original: "!*", pat: "**/*", whitelist: true, only_dir: false }
DEBUG:rg::ignore: ./SOMEPRJ/abc/def/XXX/YYY whitelisted by Pattern { from: "/home/kmodi/.rgignore", original: "!*", pat: "**/*", whitelist: true, only_dir: false }
DEBUG:rg::ignore: ./SOMEPRJ/abc/def/XXX/YYY/bar whitelisted by Pattern { from: "/home/kmodi/.rgignore", original: "!*", pat: "**/*", whitelist: true, only_dir: false }
DEBUG:rg::ignore: ./SOMEPRJ/ghi whitelisted by Pattern { from: "/home/kmodi/.rgignore", original: "!*", pat: "**/*", whitelist: true, only_dir: false }
DEBUG:rg::ignore: ./SOMEPRJ/ghi/XXX whitelisted by Pattern { from: "/home/kmodi/.rgignore", original: "!*", pat: "**/*", whitelist: true, only_dir: false }
DEBUG:rg::ignore: ./SOMEPRJ/ghi/XXX/YYY whitelisted by Pattern { from: "/home/kmodi/.rgignore", original: "!*", pat: "**/*", whitelist: true, only_dir: false }
DEBUG:rg::ignore: ./SOMEPRJ/ghi/XXX/YYY/bar whitelisted by Pattern { from: "/home/kmodi/.rgignore", original: "!*", pat: "**/*", whitelist: true, only_dir: false }
DEBUG:rg::ignore: ./SOMEPRJ/.rgignore ignored because it is hidden
SOMEPRJ/abc/def/XXX/YYY/bar
1:foo
SOMEPRJ/ghi/XXX/YYY/bar
1:foo
I believe this works (just that this repeats the bug in #50).
Thanks,
I only concern is that if you implement a global ignore file in $HOME/ripgrep/ignore
( #45 ), then how would the priority work?
Then I would need to put !*
in $HOME/ripgrep/ignore
that would override the ignores in ~/.gitignore
? But wouldn't that be the wrong order?
On the other hand, if I put !*
in ~/.rgignore
, then wouldn't that override all the ignores in $HOME/ripgrep/ignore
? :)
from ripgrep.
It seems like the priority of any "global" ignores file should come strictly after any ignores from inside parent directories are considered. If you want to override ~/.gitignore
then it makes sense that you should use a ~/.rgignore
to do it.
from ripgrep.
It sounds like this use case should be solved either by a global ignore file (#45) or by using explicit per-directory overrides.
from ripgrep.
This issue was more related to #68.
The fix for that issue ( 8eeb0c0 ) fixes this issue too.
Thanks!
from ripgrep.
Related Issues (20)
- multiline search regex wildcard not expanding HOT 1
- Precompiled binary for powerpc64le HOT 1
- Add Vuejs as a file list to type-list HOT 1
- zero or more quantifier does not work HOT 1
- Inconsistent behavior with negation pattern in `.gitignore` HOT 8
- compiling with simd-accel feature is broken due to removal of stdsimd feature in nightly breaking the packed_simd crate HOT 1
- File named `.config` is ignored for no reason HOT 1
- Process substitution search path behavior change in 14.0.0
- [feature] Line masking (ignoring lines or part of lines in matching but displayed in output) HOT 3
- Provide Statically Compiled Binaries for (aarch64|arm64) Linux HOT 1
- Include regex syntax in man page HOT 1
- Include ---no-ignore-files in --unrestricted option? HOT 1
- ripgrep mis-parses `*[\<\>\:\"\/\\\|\?\*]*` in `.gitignore` HOT 2
- Incorrect application of ignore rule with single glob in nested HOT 1
- Since nightly-2024-02-06 , could not compile with --features 'simd-accel' HOT 4
- rg allocates too much memory with: `rg --files --ignore-file ~/.ultimate-gitignore` HOT 2
- Repo HOT 1
- When i using rg to find file's type of rust, it doesn't work. HOT 1
- Typo in help description for --vimgrep option: "im" instead of "in" HOT 1
- rg spins in a nanosleep loop when one thread is blocked on a fifo
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ripgrep.