do ignore files ignore things based on file path or file contents? #2258
-
What version of ripgrep are you using?ripgrep 13.0.0 (rev af6b6c5) How did you install ripgrep?unzip What operating system are you using ripgrep on?Windows 10 Describe your bug.--ignore-file optional not working What are the steps to reproduce the behavior?echo aaa >> test.txt What is the actual behavior?
What is the expected behavior?-- test.txt should be excluded from the result test2.txt |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
Ignore files only ignore things based on the file path. From your example, it seems like you've somehow come under the impression that they work by looking at the file contents. They don't, just like I've converted this to a Discussion Question because this isn't a bug. And I made the title a bit more descriptive. |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for quick response.
I get confused here. I am using file path. There are two files containing
aaa text, test1.txt and test2.txt. when searching, I want to ignore one of
them test1.txt and only test2.txt is returned
So I am using
Rg --ignore-file test1.txt aaa
I did not specify the folder, the default is current folder.
…On Thu, Jul 14, 2022, 8:35 AM Andrew Gallant ***@***.***> wrote:
Ignore files only ignore things based on the *file path*. From your
example, it seems like you've somehow come under the impression that they
work by looking at the *file contents*. They don't, just like .gitignore
files don't. Only file paths. So if you want to ignore test2.txt, you
need to put test2.txt in your ignore file.
I've converted this to a Discussion Question because this isn't a bug. And
I made the title a bit more descriptive.
—
Reply to this email directly, view it on GitHub
<#2258 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD55YGSWUIYGFWX2GSX3X33VUAJT5ANCNFSM53SJF44Q>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
super. that is exactly what I am looking for.
I missed this -g option obviously.
the command for my case should be
rg -g "test.txt" aaa
Thanks alot
…On Thu, Jul 14, 2022 at 9:53 AM Andrew Gallant ***@***.***> wrote:
Of course you can do ad hoc exclusion on the command line. That's done via -g
'!test1.txt', for example. Have you read the GUIDE
<https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md#manual-filtering-globs>
?
—
Reply to this email directly, view it on GitHub
<#2258 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD55YGXTPQ46G5ECU6YS3U3VUASYLANCNFSM53SJF44Q>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Thanks
Johnson Zhao
|
Beta Was this translation helpful? Give feedback.
-
by the way, great program , much faster than grep and ag.
|
Beta Was this translation helpful? Give feedback.
Ignore files only ignore things based on the file path. From your example, it seems like you've somehow come under the impression that they work by looking at the file contents. They don't, just like
.gitignore
files don't. Only file paths. So if you want to ignoretest2.txt
, you need to puttest2.txt
in your ignore file.I've converted this to a Discussion Question because this isn't a bug. And I made the title a bit more descriptive.