Skip to content

Commit b3b3203

Browse files
committed
refactor
1 parent 504afec commit b3b3203

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

gix-discover/tests/isolated.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn in_cwd_upwards_from_nested_dir() -> gix_testtools::Result {
1515
repo_path.kind(),
1616
gix_discover::repository::Kind::WorkTree { linked_git_dir: None },
1717
);
18-
assert_eq!(repo_path.as_ref(), Path::new("."));
18+
assert_eq!(repo_path.as_ref(), Path::new("."), "{dir}");
1919
}
2020
Ok(())
2121
}
@@ -76,9 +76,10 @@ fn upwards_with_relative_directories_and_optional_ceiling() -> gix_testtools::Re
7676
("./././very/deeply/nested/subdir", ".."),
7777
("very/deeply/nested/subdir", ".."),
7878
] {
79+
let search_dir = Path::new(search_dir);
7980
let ceiling_dir = cwd.join(ceiling_dir_component);
8081
let (repo_path, _trust) = gix_discover::upwards_opts(
81-
search_dir.as_ref(),
82+
search_dir,
8283
Options {
8384
ceiling_dirs: vec![ceiling_dir],
8485
..Default::default()
@@ -87,12 +88,12 @@ fn upwards_with_relative_directories_and_optional_ceiling() -> gix_testtools::Re
8788
.expect("ceiling dir should allow us to discover the repo");
8889
assert_repo_is_current_workdir(repo_path, Path::new(".."));
8990

90-
let (repo_path, _trust) = gix_discover::upwards_opts(search_dir.as_ref(), Default::default())
91-
.expect("without ceiling dir we see the same");
91+
let (repo_path, _trust) =
92+
gix_discover::upwards_opts(search_dir, Default::default()).expect("without ceiling dir we see the same");
9293
assert_repo_is_current_workdir(repo_path, Path::new(".."));
9394

9495
let (repo_path, _trust) = gix_discover::upwards_opts(
95-
search_dir.as_ref(),
96+
search_dir,
9697
Options {
9798
ceiling_dirs: vec![PathBuf::from("..")],
9899
..Default::default()
@@ -102,17 +103,15 @@ fn upwards_with_relative_directories_and_optional_ceiling() -> gix_testtools::Re
102103
assert_repo_is_current_workdir(repo_path, Path::new(".."));
103104

104105
let err = gix_discover::upwards_opts(
105-
search_dir.as_ref(),
106+
search_dir,
106107
Options {
107108
ceiling_dirs: vec![PathBuf::from(".")],
108109
..Default::default()
109110
},
110111
)
111112
.unwrap_err();
112113

113-
if Path::new(search_dir).parent() == Some(Path::new("."))
114-
|| Path::new(search_dir).parent() == Some(Path::new(""))
115-
{
114+
if search_dir.parent() == Some(".".as_ref()) || search_dir.parent() == Some("".as_ref()) {
116115
assert!(matches!(err, gix_discover::upwards::Error::NoMatchingCeilingDir));
117116
} else {
118117
assert!(matches!(

0 commit comments

Comments
 (0)