From f47b9ad7e108f29f657459569b2a41f5cdf0a74a Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 25 Jul 2026 23:25:46 +0900 Subject: fix(require-command): end input borrow before asking for confirmation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `fixed` option was read as a temporary inside the argument list of update_requirements_after_resolution(), so the Ref lived until the end of the enclosing let statement — i.e. across the whole call. When the resolved version looks like a feature branch, that call asks for confirmation, and ConsoleIO takes the same input RefCell mutably, panicking with "RefCell already borrowed". Hoisting the read into its own statement ends the borrow before the call. The expected output of the un-ignored test transcribed PHP's string concatenation operator (`[y,n]? '.'`, used to keep the trailing space visible) as a literal `.`; it now matches RequireCommandTest.php. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/src/command/require_command.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'crates/shirabe/src') diff --git a/crates/shirabe/src/command/require_command.rs b/crates/shirabe/src/command/require_command.rs index 57445b14..2826e04b 100644 --- a/crates/shirabe/src/command/require_command.rs +++ b/crates/shirabe/src/command/require_command.rs @@ -599,17 +599,18 @@ impl Command for RequireCommand { let result = match do_update_result { Ok(result) => { let final_result = if result == 0 && (requirements_to_guess.len() as i64) > 0 { + let fixed = input + .borrow() + .get_option("fixed")? + .as_bool() + .unwrap_or(false); self.update_requirements_after_resolution( &requirements_to_guess, require_key, remove_key, sort_packages, dry_run, - input - .borrow() - .get_option("fixed")? - .as_bool() - .unwrap_or(false), + fixed, )? } else { result -- cgit v1.3.1