Repository: sharkdp/fd (language: rust)

Issue:
Loosen strict handling of missing --ignore-file?
Another FZF-prompted question: in _some_ repositories, I have a `.ignore` file to help rg ignore files included in the git repo but not intended to be searched. I would like `fd` to use `.ignore` when it is present in `$PWD`, but unfortunately if the file does not exist `fd` throws an error:

```
mqudsi@Blitzkrieg /m/d/rand> fd --ignore-file .ignore hello
Error while parsing custom ignore file '.ignore': entity not found.
```

For cases where an ignore file is appended programmatically, it would be helpful to either (not necessarily silently?) ignore missing `--ignore-file` parameters or to otherwise support some sort of `--maybe-ignore-file` or `--ignore-file xxx --ignore-missing-ignore-file`.

This doesn't just apply to fzf, in my case I would like to alias `fd` to `fd --ignore-file .ignore`, too.


Discussion / hints:
Hi, thank you for your feedback!

I wasn't sure if raising an error would be the right thing to do. I think we should definitely downgrade this message to a warning. I would also be okay with adding a (possibly hidden?) `--ignore-missing-ignore-file` flag.

Also, note that `fd` supported `.ignore` files up to v6.3.0. It has just recently been changed to `.fdignore`. The reasoning is that there might be files that you would not want to search through via `rg`/`ag`/.. but might still very well try to find with `fd`. So another option would be to create a dedicated `.fdignore` file (or symlink `.ignore` to `.fdignore`) in your repositories.

Yet another option would be to make it possible to re-enable `.ignore` files in `fd` - although I haven't thought about this in detail.
I'd be in favor of reenabling `.ignore`, possibly with a `--dont-use-ignore-file` or something similar.
I think we should move forward by downgrading the error to a warning. We have just recently introduced a `print_error` function that doesn't exit `fd`, so this should be really easy to implement.

Fix patch:
diff --git a/src/walk.rs b/src/walk.rs
index 29672e7d5..565edcf8a 100644
--- a/src/walk.rs
+++ b/src/walk.rs
@@ -89,7 +89,7 @@ pub fn scan(path_vec: &[PathBuf], pattern: Arc<Regex>, config: Arc<FdOptions>) {
             match err {
                 ignore::Error::Partial(_) => (),
                 _ => {
-                    print_error_and_exit(&format!(
+                    print_error(&format!(
                         "Error while parsing custom ignore file '{}': {}.",
                         ignore_file.to_string_lossy(),
                         err.description()


Test patch: