mirror of
https://github.com/sharkdp/fd
synced 2024-09-28 20:13:34 +00:00
Add test for gitignore workaround
And make sure it works for user-supplied path of "." Also add changelog entry
This commit is contained in:
parent
6af8f092ee
commit
6647085015
|
@ -12,6 +12,8 @@
|
||||||
## Bugfixes
|
## Bugfixes
|
||||||
|
|
||||||
- Respect NO_COLOR environment variable with `--list-details` option. (#1455)
|
- Respect NO_COLOR environment variable with `--list-details` option. (#1455)
|
||||||
|
- Fix bug that would cause hidden files to be includeddespite gitignore rules
|
||||||
|
if search path is "." (#1461, BurntSushi/ripgrep#2711).
|
||||||
|
|
||||||
|
|
||||||
## Changes
|
## Changes
|
||||||
|
|
|
@ -665,6 +665,9 @@ impl Opts {
|
||||||
fn normalize_path(&self, path: &Path) -> PathBuf {
|
fn normalize_path(&self, path: &Path) -> PathBuf {
|
||||||
if self.absolute_path {
|
if self.absolute_path {
|
||||||
filesystem::absolute_path(path.normalize().unwrap().as_path()).unwrap()
|
filesystem::absolute_path(path.normalize().unwrap().as_path()).unwrap()
|
||||||
|
} else if path == Path::new(".") {
|
||||||
|
// Change "." to "./" as a workaround for https://github.com/BurntSushi/ripgrep/pull/2711
|
||||||
|
PathBuf::from("./")
|
||||||
} else {
|
} else {
|
||||||
path.to_path_buf()
|
path.to_path_buf()
|
||||||
}
|
}
|
||||||
|
|
|
@ -2599,3 +2599,16 @@ fn test_git_dir() {
|
||||||
nested/dir/.git/foo2",
|
nested/dir/.git/foo2",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_gitignore_parent() {
|
||||||
|
let te = TestEnv::new(&["sub"], &[".abc", "sub/.abc"]);
|
||||||
|
|
||||||
|
fs::File::create(te.test_root().join(".gitignore"))
|
||||||
|
.unwrap()
|
||||||
|
.write_all(b".abc\n")
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
te.assert_output_subdirectory("sub", &["--hidden"], "");
|
||||||
|
te.assert_output_subdirectory("sub", &["--hidden", "--search-path", "."], "");
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue