Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Glob patterns don't work inside directories #100

Closed
chetan opened this Issue · 19 comments
@chetan

The following pattern inside .gitignore doesn't work: log/*.log; while this works fine: *.log. I created a small test repo to display the issue:

https://github.com/chetan/silver_searcher_bug

@ggreer
Owner

Thanks for the repo. I can reproduce. I'm pretty sure I know where the problem is, but it'll probably be a few days before I have the time to dive into this.

@gjtorikian

Probably related, but even something like log/log.log does not work.

@chetan

Confirmed. Looks like the method filename_ignore_search() only takes the filename portion as a param and not the full (relative?) path as well. Updated my test repo.

@ggreer
Owner

Yeah... my bad. I'm pretty busy now, but I will be not-busy starting October 30th. I'll definitely get to this then.

@ggreer
Owner

Ok, try master now.

@chetan

Fix looks good for the original issues. Another small variation is if you only specify a subdir, e.g., log or log/, it won't match unless you add a glob pattern like log/*. I updated the test repo to reflect this.

@ggreer
Owner

Bleh. I had a return value wrong. Everything should work now.

@chetan

looks good!

@chetan chetan closed this
@ggreer
Owner


:heart:

I discovered another bug while fixing this, but most people won't notice it and the current fix kills performance. I'll have to think of a different solution before merging a fix into master.

@chetan

@ggreer does it have anything to do with processing ignore files found in subdirectories? :)

@SethTisue SethTisue referenced this issue in petdance/ack2
Open

See if we can somehow use .gitignore #28

@aeonaut

Huh. June 2015 and I'm still seeing this bug. A gitignore with log/*.log does not work; that is, ag returns results from the ignored log files. If I change that to just log/ or log, it works correctly. There's no leading slash problem (Issue #285). Just installed the latest copy of ag via homebrew. Any ideas why I still might be seeing this?

@dmix

Same here... on linux with latest build.

@tonyganch

+1, .gitignore has no effect on search results

@thomasboyt

+1 on OSX, version 0.30.0

@oliversong

+1, OSX, 0.30.0

@subev

+1, OSX, 0.30.0
It has some effects but many expanding patterns are not working as expected.

@petRUShka

Same error occurs with ag version 0.30.0.

@f1sherman f1sherman referenced this issue from a commit in f1sherman/dotfiles
@f1sherman f1sherman work around ggreer/the_silver_searcher#100 353c7d7
@balta2ar

+1, Linux version.

@dtuite

I'm seeing the same issue with 0.30.0 installed via homebrew.

Note that the trailing .log in @aeonaut's example isn't causing the problem. I'm seeing the same issue with a pattern like build/*. ag respects build/ but ignores build/*.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.