aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository/path_repository.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-18 06:38:26 +0900
committernsfisis <nsfisis@gmail.com>2026-08-18 06:38:26 +0900
commitbed0cd33ca32b95aed9d65891f97649a6f9d0069 (patch)
treec04f9f3d6c89198222f9617f4dc84bed14fc0b4e /crates/shirabe/src/repository/path_repository.rs
parentced1f9aa91ee36857fec9664c9ccd86ba2310821 (diff)
downloadphp-shirabe-bed0cd33ca32b95aed9d65891f97649a6f9d0069.tar.gz
php-shirabe-bed0cd33ca32b95aed9d65891f97649a6f9d0069.tar.zst
php-shirabe-bed0cd33ca32b95aed9d65891f97649a6f9d0069.zip
fix(process-executor): model commands as a CommandLine enum
Commands were carried as `PhpMixed`, whose `String`/`List` variants do not tell a shell command line apart from an argv list at the type level. `Perforce::execute_command` and `Git::run_command` therefore funnelled string commands through `execute_args`, spawning `p4 set` or `git command` as a single argument instead of running it through a shell as PHP does; their tests were written against that shape. Introduce `CommandLine::{Shell, Args}` and use it for every `ProcessExecutor` entry point, the mock expectation queue and the `Git::run_command` callables. The unreachable "Invalid command type" branches disappear with it, and the affected tests go back to the string expectations the PHP suite uses. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/repository/path_repository.rs')
-rw-r--r--crates/shirabe/src/repository/path_repository.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/shirabe/src/repository/path_repository.rs b/crates/shirabe/src/repository/path_repository.rs
index 05b68382..d619865b 100644
--- a/crates/shirabe/src/repository/path_repository.rs
+++ b/crates/shirabe/src/repository/path_repository.rs
@@ -256,16 +256,16 @@ impl PathRepository {
{
let mut ref1 = PhpMixed::Null;
let mut ref2 = PhpMixed::Null;
- let cmd = PhpMixed::from(vec!["git", "rev-parse", "HEAD"]);
+ let cmd = ["git", "rev-parse", "HEAD"];
let code1 = self
.process
.borrow_mut()
- .execute(cmd.clone(), &mut ref1, Some(path.as_str()))
+ .execute(&cmd, &mut ref1, Some(path.as_str()))
.unwrap_or(1);
let code2 = self
.process
.borrow_mut()
- .execute(cmd, &mut ref2, None)
+ .execute(&cmd, &mut ref2, None)
.unwrap_or(1);
if code1 == 0 && code2 == 0 && ref1.as_string() == ref2.as_string() {
package.insert(
@@ -292,7 +292,7 @@ impl PathRepository {
&& self
.process
.borrow_mut()
- .execute(PhpMixed::from(command), &mut output, Some(path.as_str()))
+ .execute(command, &mut output, Some(path.as_str()))
.unwrap_or(1)
== 0
{