broot icon indicating copy to clipboard operation
broot copied to clipboard

Ignore files without using .gitignore (.brootignore?)

Open typecasto opened this issue 3 years ago • 1 comments

I'd like a way to tell broot to ignore certain folders with a large number of useless files (~/.cache, ~/rust, ~/crates.io-index) without making a git repo around them (or hiding them). Is there a way to do this already? If not, I suggest a .brootignore file, which is parsed the same as a .gitignore file, except it's not required to be in a git repo.

typecasto avatar Oct 03 '22 19:10 typecasto

Does that cover your need : https://dystroy.org/broot/conf_file/#special-paths ?

Canop avatar Oct 04 '22 08:10 Canop

I think that would be nice, instead of .brootignore it would be great to use .ignore this would make broot compatible with fd, rg and friends, I think fd uses ignore, if I saw correctly broot does it's own parsing in ignore.rs.

Despite using broot most of the time, in certain situations, e.g. I need to share a command with colleagues I still default to rg or fd.

.ignore is useful for auto-generated files that are in the .gitignore but I want to see matches when searching, in that case special-paths is not that helpful as I need to specify a filetype rather than an absolute path.

A .ignore would leave each project to decide what can bypass .gitignore

FrancescElies avatar Aug 13 '24 09:08 FrancescElies

I think that would be nice, instead of .brootignore it would be great to use .ignore

This looks like a good idea. I'll probably have a look at that.

if I saw correctly broot does it's own parsing

Yes. Parsing isn't really the problem, the problem is incrementally managing the stack of ignore files while going down the tree. The options I tested (including git2 and the ignore crate) were very slow at that game.

Canop avatar Aug 13 '24 09:08 Canop

@FrancescElies I made https://github.com/Canop/broot/pull/931

I just noticed another use, it's not just for ignoring other files: it also allows unignoring files.

Test feedback welcome!

Canop avatar Aug 13 '24 13:08 Canop

unignoring things is mostly what I used this for

FrancescElies avatar Aug 13 '24 14:08 FrancescElies