Repository: Canop/broot (language: rust)

Issue:
Ignore files without using .gitignore (.brootignore? .ignore?)
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.


Discussion / hints:
Does that cover your need : https://dystroy.org/broot/conf_file/#special-paths ?
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](https://github.com/sharkdp/fd) uses [ignore](https://crates.io/crates/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`
> 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.

Fix patch:
diff --git a/src/git/ignore.rs b/src/git/ignore.rs
index 98ded5d3..ee71ce85 100644
--- a/src/git/ignore.rs
+++ b/src/git/ignore.rs
@@ -168,7 +168,7 @@ impl GitIgnorer {
                     chain.push(self.files.alloc(gif));
                 }
             }
-            for filename in [".gitignore", ".git/info/exclude"] {
+            for filename in [".gitignore", ".git/info/exclude", ".ignore"] {
                 let file = dir.join(filename);
                 if let Ok(gif) = GitIgnoreFile::new(&file, dir) {
                     //debug!("pushing GIF {:#?}", &gif);
@@ -203,9 +203,11 @@ impl GitIgnorer {
             parent_chain.clone()
         };
         if chain.in_repo {
-            let ignore_file = dir.join(".gitignore");
-            if let Ok(gif) = GitIgnoreFile::new(&ignore_file, dir) {
-                chain.push(self.files.alloc(gif));
+            for filename in [".gitignore", ".ignore"] {
+                let ignore_file = dir.join(filename);
+                if let Ok(gif) = GitIgnoreFile::new(&ignore_file, dir) {
+                    chain.push(self.files.alloc(gif));
+                }
             }
         }
         chain


Test patch: