summaryrefslogtreecommitdiffstats
path: root/vendor/gix-odb/src/alternate
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:36 +0000
commite02c5b5930c2c9ba3e5423fe12e2ef0155017297 (patch)
treefd60ebbbb5299e16e5fca8c773ddb74f764760db /vendor/gix-odb/src/alternate
parentAdding debian version 1.73.0+dfsg1-1. (diff)
downloadrustc-e02c5b5930c2c9ba3e5423fe12e2ef0155017297.tar.xz
rustc-e02c5b5930c2c9ba3e5423fe12e2ef0155017297.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gix-odb/src/alternate')
-rw-r--r--vendor/gix-odb/src/alternate/mod.rs15
1 files changed, 5 insertions, 10 deletions
diff --git a/vendor/gix-odb/src/alternate/mod.rs b/vendor/gix-odb/src/alternate/mod.rs
index c343ef5aa..c4e9fc8c0 100644
--- a/vendor/gix-odb/src/alternate/mod.rs
+++ b/vendor/gix-odb/src/alternate/mod.rs
@@ -42,21 +42,16 @@ pub enum Error {
/// If no alternate object database was resolved, the resulting `Vec` is empty (it is not an error
/// if there are no alternates).
/// It is an error once a repository is seen again as it would lead to a cycle.
-pub fn resolve(
- objects_directory: impl Into<PathBuf>,
- current_dir: impl AsRef<std::path::Path>,
-) -> Result<Vec<PathBuf>, Error> {
- let relative_base = objects_directory.into();
- let mut dirs = vec![(0, relative_base.clone())];
+pub fn resolve(objects_directory: PathBuf, current_dir: &std::path::Path) -> Result<Vec<PathBuf>, Error> {
+ let mut dirs = vec![(0, objects_directory.clone())];
let mut out = Vec::new();
- let cwd = current_dir.as_ref();
- let mut seen = vec![gix_path::realpath_opts(&relative_base, cwd, MAX_SYMLINKS)?];
+ let mut seen = vec![gix_path::realpath_opts(&objects_directory, current_dir, MAX_SYMLINKS)?];
while let Some((depth, dir)) = dirs.pop() {
match fs::read(dir.join("info").join("alternates")) {
Ok(input) => {
for path in parse::content(&input)?.into_iter() {
- let path = relative_base.join(path);
- let path_canonicalized = gix_path::realpath_opts(&path, cwd, MAX_SYMLINKS)?;
+ let path = objects_directory.join(path);
+ let path_canonicalized = gix_path::realpath_opts(&path, current_dir, MAX_SYMLINKS)?;
if seen.contains(&path_canonicalized) {
return Err(Error::Cycle(seen));
}