diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-07-25 23:25:46 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-07-25 23:25:46 +0900 |
| commit | f47b9ad7e108f29f657459569b2a41f5cdf0a74a (patch) | |
| tree | 06b98991ceba2b058e07b416078fd76bfa8faf1f /crates/shirabe/src/command | |
| parent | 3c39377b0c419dd4cc792aef926032b15c12b69f (diff) | |
| download | php-shirabe-f47b9ad7e108f29f657459569b2a41f5cdf0a74a.tar.gz php-shirabe-f47b9ad7e108f29f657459569b2a41f5cdf0a74a.tar.zst php-shirabe-f47b9ad7e108f29f657459569b2a41f5cdf0a74a.zip | |
fix(require-command): end input borrow before asking for confirmation
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) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/command')
| -rw-r--r-- | crates/shirabe/src/command/require_command.rs | 11 |
1 files changed, 6 insertions, 5 deletions
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 |
