From cb07e5ab67586d68db918feafbf9dbd393f5b21e Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Sun, 15 Sep 2024 20:06:50 +0900 Subject: [PATCH] cli: borrow RepoLoader from Workspace It should be slightly cheaper than constructing new RepoLoader. --- cli/src/commands/operation/diff.rs | 3 +-- cli/src/commands/operation/show.rs | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cli/src/commands/operation/diff.rs b/cli/src/commands/operation/diff.rs index 53dbff724..cec44a5b5 100644 --- a/cli/src/commands/operation/diff.rs +++ b/cli/src/commands/operation/diff.rs @@ -84,8 +84,7 @@ pub fn cmd_op_diff( ) -> Result<(), CommandError> { let workspace_command = command.workspace_helper(ui)?; let workspace_env = workspace_command.env(); - let repo = workspace_command.repo(); - let repo_loader = &repo.loader(); + let repo_loader = workspace_command.workspace().repo_loader(); let from_op; let to_op; if args.from.is_some() || args.to.is_some() { diff --git a/cli/src/commands/operation/show.rs b/cli/src/commands/operation/show.rs index 768aedfb4..9e228a8be 100644 --- a/cli/src/commands/operation/show.rs +++ b/cli/src/commands/operation/show.rs @@ -53,8 +53,7 @@ pub fn cmd_op_show( ) -> Result<(), CommandError> { let workspace_command = command.workspace_helper(ui)?; let workspace_env = workspace_command.env(); - let repo = workspace_command.repo(); - let repo_loader = &repo.loader(); + let repo_loader = workspace_command.workspace().repo_loader(); let op = workspace_command.resolve_single_op(&args.operation)?; let parents: Vec<_> = op.parents().try_collect()?; let parent_op = repo_loader.merge_operations(command.settings(), parents, None)?;