-
-
Notifications
You must be signed in to change notification settings - Fork 917
Description
Checks
- I have read the troubleshooting section and still think this is a bug.
Describe the bug you encountered:
Assume we have the following directory structure:
.
├── .abc
├── .gitignore
└── sub_directory
└── .abc
where
cat .gitignore
.abc
Using fd
in the sup_directory
with --hidden
, I get
fd --hidden
.abc
The .abc
file is shown, although it should have been ignored.
Describe what you expected to happen:
Do not show the .abc
file.
Note that this only happens in the sup_directory
. Using fd --hidden
in the root directory shows the expected output.
Possible Fix:
diff --git a/src/cli.rs b/src/cli.rs
index 0007a31..3a7081f 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -643,7 +643,7 @@ impl Opts {
} else if !self.search_path.is_empty() {
&self.search_path
} else {
- let current_directory = Path::new(".");
+ let current_directory = Path::new("./");
ensure_current_directory_exists(current_directory)?;
return Ok(vec![self.normalize_path(current_directory)]);
};
All tests pass in the github workflows with this change.
The bug is not really caused by something fd
is doing but rather by what the "Walker" in the ignore
dependency is doing. A simple loop over WalkBuilder::new(path).hidden(false).build()
with path = "."
and path = "./"
leads to the same wrong and correct results, respectively. Maybe one could report it as a bug there? I'm rather confused by this behavior though.
Anyways, the diff above should fix it in fd
, I think (could open a PR if you want).
What version of fd
are you using?
fd 9.0.0
Which operating system / distribution are you on?
Linux 6.1.69-1-lts x86_64