beyondgrep / ack2

**ack 2 is no longer being maintained. ack 3 is the latest version.**
https://github.com/beyondgrep/ack3/
Other
1.48k stars 140 forks source link

ack ignoring RCS directory (was: ack not finding content that is there) #642

Closed robinbowes closed 7 years ago

robinbowes commented 7 years ago

So, I noticed today that ack is not finding some matches in a directory tree that it should be finding.

For example:

$ ack infoblox -l
cx_base/cx-cell-default.fwr.yaml
whc-servicetier/whc-servicetier.yaml

Same search, with grep -R:

  grep -lR  '10\.120\.193\.240'  .
./cx_base/cx-cell-default.fwr.yaml
./RCS/rcs.yaml
./whc-servicetier/whc-servicetier.yaml

Same search with ag:

  ag '10\.120\.193\.240' -l
cx_base/cx-cell-default.fwr.yaml
RCS/rcs.yaml
whc-servicetier/whc-servicetier.yaml

This is ack 2.18, installed on OSX using Homebrew.

petdance commented 7 years ago

That's because RCS directories are ignored by ack. RCS is a version control system, even though it might not be why you have a directory called RCS.

petdance commented 7 years ago

Unfortunately there's not a mechanism to tell ack to NOT ignore that RCS directory. :-(

robinbowes commented 7 years ago

https://media.giphy.com/media/6OWIl75ibpuFO/giphy.gif

petdance commented 7 years ago

https://media.giphy.com/media/6OWIl75ibpuFO/giphy.gif

I'm afraid I'm not very good at deciphering GIFs. I can imagine at least two different things that you're trying to convey, but I'd rather not guess.

n1vux commented 7 years ago

Has Robin inadvertently collided with ancient ./RCS/ directory by up-casing a Kubernetes ./rcs/ replication directory ?

n1vux commented 7 years ago

Supporting a --no-ignore-dir=RCS override would be appropriate

robinbowes commented 7 years ago

I concur that https://github.com/petdance/ack3/issues/75 is the right way forward.

petdance commented 7 years ago

You can use --ignore-ack-defaults right now.

robinbowes commented 7 years ago

I could, yes. But I think this is more a failure of expectation than any real problem with ack.

I mean, does anyone still use RCS??

petdance commented 7 years ago

I mean, does anyone still use RCS??

I don't know, do they?

petdance commented 7 years ago

I mean, does anyone still use RCS??

If you can provide some sort of authoritative answer to this question, it would be helpful. Otherwise we're just guessing.

n1vux commented 7 years ago

One of my use-cases for ack is inspecting legacy source code trees of new clients. We clean up legacy spaghetti-spills. I could find RCS, SCCS, or CVS, or all three in one place if they've not cleaned up previously! Current new client is still using CVS but agrees we can use Git for the assignment and migrate rest of their stuff as we get to it ! This is a win. A recent client had at least moved up to SVN ... so running across RCS in the wild is possible. Maybe it won't be in use and can be rm'd, but I may indeed want to ack through a read-only tree. But ./RCS is not as unique as ./.git/ since not hidden, and hardly a unique acronym, so maybe dropping automagic DWIMery for RCS in ack3 and letting me add --ignore-dir=RCS when i find it is better DWIM.

OTOH, --no-ignore-dir= should also be able to override any built-in, for orthogonal-ness. Even if --no-ignore-dir=.git is inefficient compared to find ~ -path \*/.git/config -print0 | xargs -0 ack 'url =' it should be allowed.

robinbowes commented 7 years ago

The only valid data point you can take from this is that I was surprised that ack ignored the directory named RCS.

It's your call how significant you feel this is.