Skip to content

Commit

Permalink
workspace: make the constructor public
Browse files Browse the repository at this point in the history
This allows constructing a workspace in a custom environment where the standard filesystem API cannot be used
  • Loading branch information
torquestomp committed Jul 31, 2024
1 parent 82ebcd2 commit 14ca553
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions lib/src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,29 @@ fn init_working_copy(
}

impl Workspace {
fn new(
pub fn new(
workspace_root: &Path,
working_copy: Box<dyn WorkingCopy>,
repo_loader: RepoLoader,
) -> Result<Workspace, PathError> {
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<dyn WorkingCopy>,
repo_loader: RepoLoader,
) -> Self {
Self {
workspace_root,
repo_loader,
working_copy,
})
}
}

pub fn init_local(
Expand Down

0 comments on commit 14ca553

Please sign in to comment.