From 3c2ad0ea0b7d15a7812bdef0be6c09d199de165d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Sat, 2 Mar 2019 03:55:50 +0100 Subject: [PATCH] Fix check if job is already done --- src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index c71a677..602a73e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -193,7 +193,7 @@ impl BenchmarkRepository benchmark_repository } - pub fn file_exists(&self, file_path: &Path, branch_name: &str) -> bool + pub fn directory_exists(&self, directory_path: &Path, branch_name: &str) -> bool { let tip_reference_name = format!("refs/remotes/origin/{}", branch_name); let tip_reference = match self.repository.find_reference(&tip_reference_name) @@ -208,13 +208,13 @@ impl BenchmarkRepository Err(error) => panic!("Could not peel reference to tree: {}", error), }; - let object_id = match tree.get_path(file_path) + let object_id = match tree.get_path(directory_path) { Ok(tree_entry) => tree_entry.id(), Err(_) => return false, }; - if let Err(_) = self.repository.find_blob(object_id) + if let Err(_) = self.repository.find_tree(object_id) { return false; } @@ -260,7 +260,7 @@ impl BenchmarkRepository pub fn is_job_done(&self, key: &str) -> bool { - self.file_exists(Path::new(key), "results") + self.directory_exists(Path::new(key), "results") } pub fn create_job(&mut self, key: String) -> &Job