mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-28 15:26:25 +00:00
workspace: take old repo path as separate argument
As I mentioned in recent patches, I'm about to remove `ReadonlyRepo::repo_path()`.
This commit is contained in:
parent
19f383ffdd
commit
0b6714a33c
3 changed files with 5 additions and 1 deletions
|
@ -107,9 +107,11 @@ pub fn cmd_workspace_add(
|
|||
}
|
||||
|
||||
let working_copy_factory = command.get_working_copy_factory()?;
|
||||
let repo_path = old_workspace_command.repo_path();
|
||||
let (new_workspace, repo) = Workspace::init_workspace_with_existing_repo(
|
||||
command.settings(),
|
||||
&destination_path,
|
||||
repo_path,
|
||||
repo,
|
||||
working_copy_factory,
|
||||
workspace_id,
|
||||
|
|
|
@ -340,13 +340,14 @@ impl Workspace {
|
|||
pub fn init_workspace_with_existing_repo(
|
||||
user_settings: &UserSettings,
|
||||
workspace_root: &Path,
|
||||
repo_path: &Path,
|
||||
repo: &Arc<ReadonlyRepo>,
|
||||
working_copy_factory: &dyn WorkingCopyFactory,
|
||||
workspace_id: WorkspaceId,
|
||||
) -> Result<(Self, Arc<ReadonlyRepo>), WorkspaceInitError> {
|
||||
let jj_dir = create_jj_dir(workspace_root)?;
|
||||
|
||||
let repo_dir = repo.repo_path().canonicalize().context(repo.repo_path())?;
|
||||
let repo_dir = repo_path.canonicalize().context(repo_path)?;
|
||||
let repo_file_path = jj_dir.join("repo");
|
||||
let mut repo_file = File::create(&repo_file_path).context(&repo_file_path)?;
|
||||
repo_file
|
||||
|
|
|
@ -54,6 +54,7 @@ fn test_init_additional_workspace() {
|
|||
let (ws2, repo) = Workspace::init_workspace_with_existing_repo(
|
||||
&settings,
|
||||
&ws2_root,
|
||||
test_workspace.repo_path(),
|
||||
&test_workspace.repo,
|
||||
&*default_working_copy_factory(),
|
||||
ws2_id.clone(),
|
||||
|
|
Loading…
Reference in a new issue