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/store (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
57 Err(err) => return Err(err),57 Err(err) => return Err(err),
58 }58 }
59 }59 }
60 todo!("check remotes HEAD")60 self.find_inner("remotes", &relative_path.join("HEAD"), Transform::EnforceRefsPrefix)
61 }61 }
62 62
63 fn find_inner(63 fn find_inner(
@@ -78,7 +78,12 @@ mod find { · 14 unmodified lines
78 }78 }
79 .join(inbetween)79 .join(inbetween)
80 .join(relative_path);80 .join(relative_path);
81
81 let ref_path = self.base.join(&relative_path);82 let ref_path = self.base.join(&relative_path);
83 if ref_path.is_dir() {
84 return Ok(None);
85 }
86
82 let mut contents = Vec::new();87 let mut contents = Vec::new();
83 match std::fs::File::open(ref_path) {88 match std::fs::File::open(ref_path) {
84 Err(err) if err.kind() == io::ErrorKind::NotFound => return Ok(None),89 Err(err) if err.kind() == io::ErrorKind::NotFound => return Ok(None),