upvote
> Obviously smarter people than I disagree, but my dumdum head just feels that way.

That's absolutely not it. What you're describing is part of the UNIX philosophy: programs should do one thing and do it well, and they should function in a way that makes them very versatile and composable, etc.

And that part of the philosophy works GREAT when everything follows another part of the philosophy: everything should be based on flat text files.

But for a number of reasons, and regardless of whatever we all think of those reasons, we live in a world that has a lot of stuff that is NOT the kind of flat text file grep was made for. Binary formats, minified JS, etc. And so to make the tool more practical on a modern *nix workstation, suddenly more people want defaults that are going to work on their flat text files and transparently ignore things like .git.

It's just that you've showed up to an wildly unprincipled world armed with principles.

reply
Sure, but that UNIX philosophy is what got us "grep -r" as the way to search files across an entire directory, which would then compose with stuff like xargs and parallel to be able to do things concurrently. I'd argue that ripgrep shows that that bundling together stuff sometimes does end up with a user experience that people prefer. The nuance lies in figuring out where the balance between "not enough" and "too much" lies, and so far I've yet to see a pithy statement like the UNIX philosophy encapsulate it well.

Alternately, maybe people's idea of what "one thing" is ends up being more subjective than it sounds (or at least depends on context). "Searching through my code" at least sounds like a reasonable idea of "one thing", and it's not crazy that someone might consider "don't search though the stuff that isn't my code, like my npm dependencies or my Rust build artifacts" would be part of "doing it well". Having to specify it every time would be annoying, so you might want to put it in a config file, but then if then if it ends up being identical to your gitignore, having to manually symlink it or copy it each time you modify it is annoying, so it's also not crazy to just use the gitignore by default with a way to opt out of it. Now we're just back where we started; custom .ignore files, fallback to .gitignore, and a flag for when you want to skip that.

reply
Back in the day I would have agreed with you, but ever since there is js everywhere you end up with minified js that megabytes big and match everything. I still have muscle memory with `grep -r` and it almost always ends up with some js file, that I didn't know exists ruining the moment.
reply
You are absolutely right. It is a good feature, but it must be a concious decision. It should not be default. You should set it in your shell alias or environment, just like you have something like

  LESS="-FQMR"
(no bell, more status, raw characters, exit if less than one page).

Those are also completely reasonable to use, but they must set conciously, otherwise the might give results that confuse the user.

reply
> Obviously smarter people than I disagree, but my dumdum head just feels that way.

No you are correct, do not doubt yourself. Baked in behavior catering to a completely separate tool is bad design. Git is the current version control software but its not the first nor last. Imagine if we move to another source control and are burdened with .gitignore files. No thanks.

The Unix tools are designed to be good and explicit at their individual jobs so they can be easily composed together to form more complex tools that cater to the task at hand.

reply
That's why a bunch of tools agreed on something that was not tied to any one of them. What did I miss? We are explicitly not talking about .gitignore.
reply
But both rg and ag ignore paths in .gitignore by default still
reply
> We are explicitly not talking about .gitignore.

Actually we are, because some utter idiot wrote:

> grep-like tools which read .gitignore violate POLA.

reply
> utter idiot

How about we keep it civilized

reply
Given that they were quoting themselves, I think it's probably intended as humor. (I had to scroll up to check but I immediately suspected, and it made me chuckle)
reply
I have to agree here. I love ripgrep, but at times I've had to go back to regular grep because I couldn't figure out what it was ignoring and why, and there were far too many settings to figure it out.
reply
FYI, `-uu` turns off both ignoring based on special files (.gitignore, etc) and ignoring hidden files.
reply
And if you want to ignore what you want rg to ignore, not what you want git to ignore? Can you do that?
reply
--no-ignore-vcs

Or some combination of --no-ignore (or -u/--unrestricted) with --ignore-file or --glob.

reply
It's a tough one. Lately I've been doing `rg -u` every single time because too many things get ignored and I can't be bothered to figure out how to configure it more cleanly to do what I want by default.
reply
ugrep agrees with you [1].

[1]: https://ugrep.com/

reply
An `--ignore-file=` flag would be nice I guess:

--ignore-file=.ignore

--ignore-file=.gitignore

--ignore-file=.dockerignore

--ignore-file=.npmignore

etc

but then, assuming all those share the same "ignore file syntax/grammar"...

reply
It's good if they can share syntax. You use the same English words to ask Alice and Bob questions, but when you say "So, tell me, Alice…" you don't want Bob to answer you instead. Using another tool's config by default, making it difficult/impossible to use the dedicated config is the most annoying thing I can imagine. If that's what rg does, I guess that must be the reason I couldn't switch.
reply
Agreed. It's a footgun.
reply
It’s the kind of thing that maybe makes sense today. Less likely to make sense twenty years from now though.

But that’s the kind of problem that only successful things have to worry about.

reply
It probably wouldn't have made sense twenty years ago (or 60 years ago, when IBM engineers first wrote about the Principle of Least Astonishment [1] in 1966).

But it does make sense today.

I'd argue that modern computers do many astonishing and complicated and confusing things - for example, they synchronize with cloud storage through complex on-demand mechanisms that present a file as being on the users' computer, but only actually download it when it's opened by the user - and they attempt to do so as a transparent abstraction of a real file on the disk. But if ripgrep tried to traverse your corporate Google Drive or Dropbox or Onedrive, users might be "astonished" when that abstraction breaks down and a minor rg query takes an hour and 800 GB of bandwidth.

It used to be that one polymath engineer could have a decent understanding of the whole pyramid of complexity, from semiconductors through spinlocks on to SQL servers. Now that goal is unachievable for most, and tools ought to be sophisticated enough to help the user with corner cases and gotchas that make their task more difficult than they expected it to be.

[1]: https://en.wikipedia.org/wiki/Principle_of_least_astonishmen...

reply
It is already leaking today. I hope/expect that jujutsu takes over in the coming years.
reply