Fix check if job is already done

This commit is contained in:
Patrick Lühne 2019-03-02 03:55:50 +01:00
parent fe51492c5b
commit 3c2ad0ea0b
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF

View File

@ -193,7 +193,7 @@ impl BenchmarkRepository
benchmark_repository 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_name = format!("refs/remotes/origin/{}", branch_name);
let tip_reference = match self.repository.find_reference(&tip_reference_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), 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(), Ok(tree_entry) => tree_entry.id(),
Err(_) => return false, Err(_) => return false,
}; };
if let Err(_) = self.repository.find_blob(object_id) if let Err(_) = self.repository.find_tree(object_id)
{ {
return false; return false;
} }
@ -260,7 +260,7 @@ impl BenchmarkRepository
pub fn is_job_done(&self, key: &str) -> bool 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 pub fn create_job(&mut self, key: String) -> &Job