From 14ca55317f71415cc1dbe933cbc94b07f8f0ef16 Mon Sep 17 00:00:00 2001 From: dploch Date: Wed, 31 Jul 2024 11:22:42 -0400 Subject: [PATCH] workspace: make the constructor public This allows constructing a workspace in a custom environment where the standard filesystem API cannot be used --- lib/src/workspace.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/src/workspace.rs b/lib/src/workspace.rs index 4cd5c8a55f..6a66ae9525 100644 --- a/lib/src/workspace.rs +++ b/lib/src/workspace.rs @@ -131,17 +131,29 @@ fn init_working_copy( } impl Workspace { - fn new( + pub fn new( workspace_root: &Path, working_copy: Box, repo_loader: RepoLoader, ) -> Result { let workspace_root = workspace_root.canonicalize().context(workspace_root)?; - Ok(Workspace { + Ok(Self::new_no_canonicalize( + workspace_root, + working_copy, + repo_loader, + )) + } + + pub fn new_no_canonicalize( + workspace_root: PathBuf, + working_copy: Box, + repo_loader: RepoLoader, + ) -> Self { + Self { workspace_root, repo_loader, working_copy, - }) + } } pub fn init_local(