History

[git-ref] handle all find_one cases as per docs

Sebastian Thiel committed 5 years ago

Commit 3c0acc61 parent b3c4e923 files · +18 −1Browse files

Showing the changes to git-ref/src (1 of 3 files). Show all

Unified · Split

git-ref/src/store/loose/backend.rs+6−1
@@ -57,7 +57,7 @@ mod find { · 56 unmodified lines
5757 Err(err) => return Err(err),
5858 }
5959 }
60− todo!("check remotes HEAD")
60+ self.find_inner("remotes", &relative_path.join("HEAD"), Transform::EnforceRefsPrefix)
6161 }
6262
6363 fn find_inner(
@@ -78,7 +78,12 @@ mod find { · 14 unmodified lines
7878 }
7979 .join(inbetween)
8080 .join(relative_path);
81+
8182 let ref_path = self.base.join(&relative_path);
83+ if ref_path.is_dir() {
84+ return Ok(None);
85+ }
86+
8287 let mut contents = Vec::new();
8388 match std::fs::File::open(ref_path) {
8489 Err(err) if err.kind() == io::ErrorKind::NotFound => return Ok(None),