From 3498bb1ca00ab7d051d296b8d482bea987a00fa4 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 25 Jun 2026 17:02:11 +0900 Subject: test: port 24 command/repository/package/util tests; add TlsHelper Port command (9), util gitlab/forgejo/tls (6), package (6), repository (3) tests. Implement TlsHelper. Fix porting bugs: config_command extra merge, RootAliasPackage setters, ValidatingArrayLoader isset, repository_factory name generation, forgejo exception code, version_parser error chaining. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/src/repository/repository_factory.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'crates/shirabe/src/repository') diff --git a/crates/shirabe/src/repository/repository_factory.rs b/crates/shirabe/src/repository/repository_factory.rs index 47caf59..9cc4e4d 100644 --- a/crates/shirabe/src/repository/repository_factory.rs +++ b/crates/shirabe/src/repository/repository_factory.rs @@ -4,6 +4,7 @@ use indexmap::IndexMap; use shirabe_external_packages::composer::pcre::Preg; use shirabe_php_shim::{ InvalidArgumentException, PhpMixed, UnexpectedValueException, get_debug_type, json_encode, + php_to_string, }; use crate::config::Config; @@ -318,15 +319,11 @@ impl RepositoryFactory { repo: &IndexMap, existing_repos: &IndexMap, ) -> String { - let mut name = match index { - PhpMixed::Int(_) => { - if let Some(url) = repo.get("url").and_then(|v| v.as_string()) { - Preg::replace("{^https?://}i", "", url) - } else { - index.as_string().unwrap_or("").to_string() - } - } - _ => index.as_string().unwrap_or("").to_string(), + let mut name = if matches!(index, PhpMixed::Int(_)) && repo.contains_key("url") { + let url = repo.get("url").and_then(|v| v.as_string()).unwrap_or(""); + Preg::replace("{^https?://}i", "", url) + } else { + php_to_string(index) }; while existing_repos.contains_key(&name) { name.push('2'); -- cgit v1.3.1