Checks
Describe the bug you encountered:
Assume we have the following directory structure:
.
├── .abc
├── .gitignore
└── sub_directory
└── .abc
where
Using fd in the sup_directory with --hidden, I get
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
Checks
Describe the bug you encountered:
Assume we have the following directory structure:
where
Using
fdin thesup_directorywith--hidden, I getThe
.abcfile is shown, although it should have been ignored.Describe what you expected to happen:
Do not show the
.abcfile.Note that this only happens in the
sup_directory. Usingfd --hiddenin the root directory shows the expected output.Possible Fix:
All tests pass in the github workflows with this change.
The bug is not really caused by something
fdis doing but rather by what the "Walker" in theignoredependency is doing. A simple loop overWalkBuilder::new(path).hidden(false).build()withpath = "."andpath = "./"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
fdare you using?fd 9.0.0
Which operating system / distribution are you on?