workspace: remove redundant cloning from init_external_git()

Apparently, I forgot to update it in 1db033504c "repo, workspace: remove
'static lifetime bound from initializer functions."
This commit is contained in:
Yuya Nishihara 2023-12-05 16:23:40 +09:00 committed by Martin von Zweigbergk
parent 899c6375a0
commit 787fa1340b

View file

@ -197,10 +197,8 @@ impl Workspace {
workspace_root: &Path,
git_repo_path: &Path,
) -> Result<(Self, Arc<ReadonlyRepo>), WorkspaceInitError> {
let backend_initializer = {
let workspace_root = workspace_root.to_owned();
let git_repo_path = git_repo_path.to_owned();
move |settings: &UserSettings, store_path: &Path| -> Result<Box<dyn Backend>, _> {
let backend_initializer =
|settings: &UserSettings, store_path: &Path| -> Result<Box<dyn Backend>, _> {
// If the git repo is inside the workspace, use a relative path to it so the
// whole workspace can be moved without breaking.
// TODO: Clean up path normalization. store_path is canonicalized by
@ -218,8 +216,7 @@ impl Workspace {
let backend =
GitBackend::init_external(settings, store_path, &store_relative_git_repo_path)?;
Ok(Box::new(backend))
}
};
};
let signer = Signer::from_settings(user_settings)?;
Self::init_with_backend(user_settings, workspace_root, &backend_initializer, signer)
}