aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--crates/shirabe/src/repository/vcs/github_driver.rs17
-rw-r--r--crates/shirabe/tests/repository/vcs/github_driver_test.rs1
2 files changed, 9 insertions, 9 deletions
diff --git a/crates/shirabe/src/repository/vcs/github_driver.rs b/crates/shirabe/src/repository/vcs/github_driver.rs
index 37bba1c7..94daf05c 100644
--- a/crates/shirabe/src/repository/vcs/github_driver.rs
+++ b/crates/shirabe/src/repository/vcs/github_driver.rs
@@ -326,9 +326,9 @@ impl GitHubDriver {
.map(|m| m.contains_key("source"))
.unwrap_or(false);
if support_source_missing {
+ // PHP's `?:` chain only evaluates getBranches() when the tags search is falsy.
let tags_map = self.get_tags()?;
- let branches_map = self.get_branches()?;
- let label = array_search_mixed(
+ let mut label = array_search_mixed(
&PhpMixed::String(identifier.to_string()),
&PhpMixed::Array(
tags_map
@@ -338,9 +338,10 @@ impl GitHubDriver {
),
false,
)
- .filter(|v| !matches!(v, PhpMixed::Bool(false) | PhpMixed::Null))
- .or_else(|| {
- array_search_mixed(
+ .filter(|v| !matches!(v, PhpMixed::Bool(false) | PhpMixed::Null));
+ if label.is_none() {
+ let branches_map = self.get_branches()?;
+ label = array_search_mixed(
&PhpMixed::String(identifier.to_string()),
&PhpMixed::Array(
branches_map
@@ -350,9 +351,9 @@ impl GitHubDriver {
),
false,
)
- })
- .filter(|v| !matches!(v, PhpMixed::Bool(false) | PhpMixed::Null))
- .unwrap_or_else(|| PhpMixed::String(identifier.to_string()));
+ .filter(|v| !matches!(v, PhpMixed::Bool(false) | PhpMixed::Null));
+ }
+ let label = label.unwrap_or_else(|| PhpMixed::String(identifier.to_string()));
let label_str = label.as_string().unwrap_or(identifier).to_string();
if let Some(support) = composer.get_mut("support").and_then(|v| match v {
PhpMixed::Array(m) => Some(m),
diff --git a/crates/shirabe/tests/repository/vcs/github_driver_test.rs b/crates/shirabe/tests/repository/vcs/github_driver_test.rs
index 8b30a796..dfdbb01e 100644
--- a/crates/shirabe/tests/repository/vcs/github_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/github_driver_test.rs
@@ -613,7 +613,6 @@ fn test_funding_format() {
}
}
-#[ignore = "funding/archived parsing differs from PHP; not date-related"]
#[test]
fn test_public_repository_archived() {
let SetUp { home, config } = set_up();