From 8e19226171ac752018a6e159e50e6733e5a891d5 Mon Sep 17 00:00:00 2001 From: Waleed Khan Date: Mon, 21 Aug 2023 13:28:29 -0700 Subject: [PATCH] commands: destructure `SplitArgs` exhaustively To warn us to update use-sites when adding new flags. --- cli/src/commands/mod.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cli/src/commands/mod.rs b/cli/src/commands/mod.rs index 2db9fd1b63..4d92e86ff4 100644 --- a/cli/src/commands/mod.rs +++ b/cli/src/commands/mod.rs @@ -3046,14 +3046,15 @@ fn diff_summary_to_description(bytes: &[u8]) -> String { #[instrument(skip_all)] fn cmd_split(ui: &mut Ui, command: &CommandHelper, args: &SplitArgs) -> Result<(), CommandError> { + let SplitArgs { revision, paths } = args; let mut workspace_command = command.workspace_helper(ui)?; - let commit = workspace_command.resolve_single_rev(&args.revision, ui)?; + let commit = workspace_command.resolve_single_rev(revision, ui)?; workspace_command.check_rewritable(&commit)?; - let matcher = workspace_command.matcher_from_values(&args.paths)?; + let matcher = workspace_command.matcher_from_values(paths)?; let mut tx = workspace_command.start_transaction(&format!("split commit {}", commit.id().hex())); let base_tree = merge_commit_trees(tx.repo(), &commit.parents())?; - let interactive = args.paths.is_empty(); + let interactive = paths.is_empty(); let instructions = format!( "\ You are splitting a commit in two: {} @@ -3083,7 +3084,7 @@ don't make any changes, then the operation will be aborted. writeln!( ui.warning(), "The given paths do not match any file: {}", - args.paths.join(" ") + paths.join(" ") )?; }