Glob patterns don't work inside directories #100

Open
chetan opened this Issue Oct 23, 2012 · 29 comments

Comments

Projects
None yet
@chetan

chetan commented Oct 23, 2012

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

This comment has been minimized.

Show comment
Hide comment
@ggreer

ggreer Oct 24, 2012

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.

Owner

ggreer commented Oct 24, 2012

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

This comment has been minimized.

Show comment
Hide comment
@gjtorikian

gjtorikian Oct 26, 2012

Contributor

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

Contributor

gjtorikian commented Oct 26, 2012

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

@chetan

This comment has been minimized.

Show comment
Hide comment
@chetan

chetan Oct 27, 2012

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.

chetan commented Oct 27, 2012

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

This comment has been minimized.

Show comment
Hide comment
@ggreer

ggreer Oct 27, 2012

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.

Owner

ggreer commented Oct 27, 2012

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

This comment has been minimized.

Show comment
Hide comment
@ggreer

ggreer Nov 6, 2012

Owner

Ok, try master now.

Owner

ggreer commented Nov 6, 2012

Ok, try master now.

@chetan

This comment has been minimized.

Show comment
Hide comment
@chetan

chetan Nov 6, 2012

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.

chetan commented Nov 6, 2012

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

This comment has been minimized.

Show comment
Hide comment
@ggreer

ggreer Nov 6, 2012

Owner

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

Owner

ggreer commented Nov 6, 2012

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

@chetan

This comment has been minimized.

Show comment
Hide comment
@chetan

chetan Nov 6, 2012

looks good!

chetan commented Nov 6, 2012

looks good!

@chetan chetan closed this Nov 6, 2012

@ggreer

This comment has been minimized.

Show comment
Hide comment
@ggreer

ggreer Nov 6, 2012

Owner


❤️

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.

Owner

ggreer commented Nov 6, 2012


❤️

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

This comment has been minimized.

Show comment
Hide comment
@chetan

chetan Nov 8, 2012

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

chetan commented Nov 8, 2012

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

@SethTisue SethTisue referenced this issue in beyondgrep/ack2 Jan 20, 2015

Closed

See if we can somehow use .gitignore #28

@aeonaut

This comment has been minimized.

Show comment
Hide comment
@aeonaut

aeonaut Jun 17, 2015

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?

aeonaut commented Jun 17, 2015

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

This comment has been minimized.

Show comment
Hide comment
@dmix

dmix Jun 20, 2015

Same here... on linux with latest build.

dmix commented Jun 20, 2015

Same here... on linux with latest build.

@petRUShka

This comment has been minimized.

Show comment
Hide comment
@petRUShka

petRUShka Jul 10, 2015

Same error occurs with ag version 0.30.0.

Same error occurs with ag version 0.30.0.

f1sherman added a commit to f1sherman/dotfiles that referenced this issue Jul 13, 2015

@dtuite

This comment has been minimized.

Show comment
Hide comment
@dtuite

dtuite Jul 25, 2015

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/*.

dtuite commented Jul 25, 2015

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/*.

@jamesgecko

This comment has been minimized.

Show comment
Hide comment
@jamesgecko

jamesgecko Nov 5, 2015

This issue appears to be present in 0.31.0 from homebrew on OS X 10.11.1.

This issue appears to be present in 0.31.0 from homebrew on OS X 10.11.1.

@stevschmid

This comment has been minimized.

Show comment
Hide comment
@stevschmid

stevschmid Nov 18, 2015

I just ran into the same issue as @jamesgecko

I just ran into the same issue as @jamesgecko

rglassett added a commit to rglassett/dotfiles that referenced this issue Feb 3, 2016

@alcuadrado

This comment has been minimized.

Show comment
Hide comment
@alcuadrado

alcuadrado Feb 11, 2016

I can confirm that the bug is present in 0.31.0 from homebrew on OS X 10.11.1.

I can confirm that the bug is present in 0.31.0 from homebrew on OS X 10.11.1.

@jonjonw

This comment has been minimized.

Show comment
Hide comment
@jonjonw

jonjonw May 20, 2016

The bug is also in 0.32.0 from homebrew on OSX 10.11.5.

jonjonw commented May 20, 2016

The bug is also in 0.32.0 from homebrew on OSX 10.11.5.

@Dmitra

This comment has been minimized.

Show comment
Hide comment
@Dmitra

Dmitra Jun 21, 2016

@chetan, please reopen this issue, as it's still relevant

Dmitra commented Jun 21, 2016

@chetan, please reopen this issue, as it's still relevant

@atsepkov

This comment has been minimized.

Show comment
Hide comment
@atsepkov

atsepkov Jul 14, 2016

I too am seeing this with ag 0.30.0 on OSX 10.10.5

I too am seeing this with ag 0.30.0 on OSX 10.10.5

@HerringtonDarkholme

This comment has been minimized.

Show comment
Hide comment
@HerringtonDarkholme

HerringtonDarkholme Oct 24, 2016

Confirmed on 0.33.0, OSX Sierra

Confirmed on 0.33.0, OSX Sierra

@iammerrick

This comment has been minimized.

Show comment
Hide comment
@iammerrick

iammerrick Dec 16, 2016

Also seeing this on latest Ag + Sierra

Also seeing this on latest Ag + Sierra

@anhari anhari referenced this issue in thoughtbot/dotfiles Dec 28, 2016

Closed

The silver searcher and gitignore dependencies #507

@subhojit777

This comment has been minimized.

Show comment
Hide comment
@subhojit777

subhojit777 Feb 22, 2017

Ag version 1.0.2
macOS Sierra 10.12.2

At first I thought there is some issue with ag, then I found that path was not configured properly in .gitignore. After correcting that, ag started ignoring the files.

Ag version 1.0.2
macOS Sierra 10.12.2

At first I thought there is some issue with ag, then I found that path was not configured properly in .gitignore. After correcting that, ag started ignoring the files.

@PezCoder

This comment has been minimized.

Show comment
Hide comment
@PezCoder

PezCoder May 20, 2017

Something like this: web/js/* expression in my .gitignore is being ignore by ag, i.e it's searching inside those directories & not ignoring it.
The above expressions works fine for git grep command that means it's a valid expression.

PezCoder commented May 20, 2017

Something like this: web/js/* expression in my .gitignore is being ignore by ag, i.e it's searching inside those directories & not ignoring it.
The above expressions works fine for git grep command that means it's a valid expression.

@tony

This comment has been minimized.

Show comment
Hide comment
@tony

tony Mar 5, 2018

@ggreer Can this issued be reopened? If not we should open a new issue. I'm getting matches of artifact files that are in gitignore.

ag version 2.1.0

Features:
  +jit +lzma +zlib

git --version
git version 2.16.2

tony commented Mar 5, 2018

@ggreer Can this issued be reopened? If not we should open a new issue. I'm getting matches of artifact files that are in gitignore.

ag version 2.1.0

Features:
  +jit +lzma +zlib

git --version
git version 2.16.2
@firedev

This comment has been minimized.

Show comment
Hide comment
@firedev

firedev Mar 22, 2018

This is a bit annoying since I am using it in vim and it tries to search through compiled files.

firedev commented Mar 22, 2018

This is a bit annoying since I am using it in vim and it tries to search through compiled files.

@jamesjtong

This comment has been minimized.

Show comment
Hide comment
@jamesjtong

jamesjtong Apr 7, 2018

Just tried with the latest silver searcher from homebrew (2.1.0). @chetan Can we reopen this?

**/dist doesnt is ignored but something like /dist works. even though their is no /dist and I want to target nested dists.

jamesjtong commented Apr 7, 2018

Just tried with the latest silver searcher from homebrew (2.1.0). @chetan Can we reopen this?

**/dist doesnt is ignored but something like /dist works. even though their is no /dist and I want to target nested dists.

@chetan chetan reopened this May 15, 2018

@chetan

This comment has been minimized.

Show comment
Hide comment
@chetan

chetan May 15, 2018

Re-opening due to popular demand, though I don't currently use ag myself.

chetan commented May 15, 2018

Re-opening due to popular demand, though I don't currently use ag myself.

@firedev

This comment has been minimized.

Show comment
Hide comment
@firedev

firedev May 25, 2018

This is getting too annoying. Is there a replacement for ag?

firedev commented May 25, 2018

This is getting too annoying. Is there a replacement for ag?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment