diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-26 01:04:43 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-26 01:04:43 +0900 |
| commit | 36ee45a9aaa5c13ce3e7f7abcce4374e25536224 (patch) | |
| tree | b7ef834886dd3be7000d06ecdfe4ae4c73cc25fe /crates/shirabe/src/config.rs | |
| parent | f639066eaf49325fdbf1b697fb24c187b2d5038e (diff) | |
| download | php-shirabe-36ee45a9aaa5c13ce3e7f7abcce4374e25536224.tar.gz php-shirabe-36ee45a9aaa5c13ce3e7f7abcce4374e25536224.tar.zst php-shirabe-36ee45a9aaa5c13ce3e7f7abcce4374e25536224.zip | |
fix(repository-command,config): delimited Preg pattern and list-form repos
RepositoryCommand's JSON-arg detection used the un-delimited regex r"^\s*\{";
the PHP source is the delimited '{^\s*\{}', which compile_php_pattern requires.
Config::merge only extracted repositories from PhpMixed::Array; a JSON array
decodes to PhpMixed::List (an array with integer keys in PHP) and was silently
dropped. Handle List by mapping to integer string keys.
Un-ignores all 10 remaining RepositoryCommandTest cases (16/16 pass).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/config.rs')
| -rw-r--r-- | crates/shirabe/src/config.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/shirabe/src/config.rs b/crates/shirabe/src/config.rs index 68cad87..b3eb47d 100644 --- a/crates/shirabe/src/config.rs +++ b/crates/shirabe/src/config.rs @@ -451,6 +451,12 @@ impl Config { .collect(); let new_repos_map: IndexMap<String, PhpMixed> = match &repositories_section { PhpMixed::Array(m) => m.iter().map(|(k, v)| (k.clone(), v.clone())).collect(), + // A JSON array decodes to a List; in PHP it is an array with integer keys. + PhpMixed::List(items) => items + .iter() + .enumerate() + .map(|(i, v)| (i.to_string(), v.clone())) + .collect(), _ => IndexMap::new(), }; let new_repos: IndexMap<String, PhpMixed> = new_repos_map.into_iter().rev().collect(); |
