summaryrefslogtreecommitdiffstats
path: root/vendor/gix-commitgraph/src/file
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gix-commitgraph/src/file')
-rw-r--r--vendor/gix-commitgraph/src/file/access.rs5
-rw-r--r--vendor/gix-commitgraph/src/file/verify.rs5
2 files changed, 6 insertions, 4 deletions
diff --git a/vendor/gix-commitgraph/src/file/access.rs b/vendor/gix-commitgraph/src/file/access.rs
index d3c32d8bb..79a40d75d 100644
--- a/vendor/gix-commitgraph/src/file/access.rs
+++ b/vendor/gix-commitgraph/src/file/access.rs
@@ -74,7 +74,10 @@ impl File {
/// Translate the given object hash to its position within this file, if present.
// copied from gix-odb/src/pack/index/ext
pub fn lookup(&self, id: impl AsRef<gix_hash::oid>) -> Option<file::Position> {
- let id = id.as_ref();
+ self.lookup_inner(id.as_ref())
+ }
+
+ fn lookup_inner(&self, id: &gix_hash::oid) -> Option<file::Position> {
let first_byte = usize::from(id.first_byte());
let mut upper_bound = self.fan[first_byte];
let mut lower_bound = if first_byte != 0 { self.fan[first_byte - 1] } else { 0 };
diff --git a/vendor/gix-commitgraph/src/file/verify.rs b/vendor/gix-commitgraph/src/file/verify.rs
index 4f4f76829..c91f6b4d2 100644
--- a/vendor/gix-commitgraph/src/file/verify.rs
+++ b/vendor/gix-commitgraph/src/file/verify.rs
@@ -160,10 +160,9 @@ impl File {
/// If the given path's filename matches "graph-{hash}.graph", check that `hash` matches the
/// expected hash.
-fn verify_split_chain_filename_hash(path: impl AsRef<Path>, expected: &gix_hash::oid) -> Result<(), String> {
- let path = path.as_ref();
+fn verify_split_chain_filename_hash(path: &Path, expected: &gix_hash::oid) -> Result<(), String> {
path.file_name()
- .and_then(|filename| filename.to_str())
+ .and_then(std::ffi::OsStr::to_str)
.and_then(|filename| filename.strip_suffix(".graph"))
.and_then(|stem| stem.strip_prefix("graph-"))
.map_or(Ok(()), |hex| match gix_hash::ObjectId::from_hex(hex.as_bytes()) {