aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository/vcs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-18 01:57:02 +0900
committernsfisis <nsfisis@gmail.com>2026-08-18 01:57:02 +0900
commite093b2be1c333e67c96aebb0a5291bea9ae3d6db (patch)
tree0743fad689f419959c3a898605e21485087884fa /crates/shirabe/src/repository/vcs
parent050c56ef263d90d862ef565bc1762909110e02eb (diff)
downloadphp-shirabe-e093b2be1c333e67c96aebb0a5291bea9ae3d6db.tar.gz
php-shirabe-e093b2be1c333e67c96aebb0a5291bea9ae3d6db.tar.zst
php-shirabe-e093b2be1c333e67c96aebb0a5291bea9ae3d6db.zip
refactor(preg): drop the offset argument from preg_match
Every call site but one passed offset 0. The remaining one, the UTF-8 chunking loop in Application, slices the subject instead: its pattern has no anchor or lookaround, so matching a suffix is equivalent to starting the search at that offset. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/repository/vcs')
-rw-r--r--crates/shirabe/src/repository/vcs/forgejo_driver.rs4
-rw-r--r--crates/shirabe/src/repository/vcs/fossil_driver.rs7
-rw-r--r--crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs8
-rw-r--r--crates/shirabe/src/repository/vcs/git_driver.rs23
-rw-r--r--crates/shirabe/src/repository/vcs/github_driver.rs26
-rw-r--r--crates/shirabe/src/repository/vcs/gitlab_driver.rs10
-rw-r--r--crates/shirabe/src/repository/vcs/hg_driver.rs11
-rw-r--r--crates/shirabe/src/repository/vcs/perforce_driver.rs6
-rw-r--r--crates/shirabe/src/repository/vcs/svn_driver.rs21
-rw-r--r--crates/shirabe/src/repository/vcs/vcs_driver.rs8
10 files changed, 50 insertions, 74 deletions
diff --git a/crates/shirabe/src/repository/vcs/forgejo_driver.rs b/crates/shirabe/src/repository/vcs/forgejo_driver.rs
index 90480add..4238be8f 100644
--- a/crates/shirabe/src/repository/vcs/forgejo_driver.rs
+++ b/crates/shirabe/src/repository/vcs/forgejo_driver.rs
@@ -17,7 +17,7 @@ use crate::util::http::Response;
use indexmap::IndexMap;
use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
- PhpMixed, RuntimeException, base64_decode, explode, extension_loaded, php_regex, preg_match2,
+ PhpMixed, RuntimeException, base64_decode, explode, extension_loaded, php_regex, preg_match,
urlencode,
};
@@ -584,7 +584,7 @@ impl ForgejoDriver {
let links = explode(",", &header);
for link in links {
- if let Some(m) = preg_match2(php_regex!(r#"{<(.+?)>; *rel="next"}"#), &link, 0)
+ if let Some(m) = preg_match(php_regex!(r#"{<(.+?)>; *rel="next"}"#), &link)
&& let Some(url) = m.get(1)
{
return Some(url.to_string());
diff --git a/crates/shirabe/src/repository/vcs/fossil_driver.rs b/crates/shirabe/src/repository/vcs/fossil_driver.rs
index c42ca271..d5a9334f 100644
--- a/crates/shirabe/src/repository/vcs/fossil_driver.rs
+++ b/crates/shirabe/src/repository/vcs/fossil_driver.rs
@@ -13,7 +13,7 @@ use chrono::{DateTime, FixedOffset, Utc};
use indexmap::IndexMap;
use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
- PhpMixed, RuntimeException, dirname, is_dir, is_file, is_writable, php_regex, preg_match2,
+ PhpMixed, RuntimeException, dirname, is_dir, is_file, is_writable, php_regex, preg_match,
preg_replace,
};
@@ -301,17 +301,16 @@ impl FossilDriver {
url: &str,
deep: bool,
) -> anyhow::Result<bool> {
- if preg_match2(
+ if preg_match(
php_regex!(r"#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i"),
url,
- 0,
)
.is_some()
{
return Ok(true);
}
- if preg_match2(php_regex!(r"!/fossil/|\.fossil!"), url, 0).is_some() {
+ if preg_match(php_regex!(r"!/fossil/|\.fossil!"), url).is_some() {
return Ok(true);
}
diff --git a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
index 9f8e7a80..a05e9835 100644
--- a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
+++ b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
@@ -19,7 +19,7 @@ use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
InvalidArgumentException, LogicException, PhpMixed, RuntimeException, array_key_exists,
array_search_mixed, extension_loaded, http_build_query, implode, is_array, php_regex,
- preg_match2, preg_replace, strpos,
+ preg_match, preg_replace, strpos,
};
#[derive(Debug)]
@@ -84,10 +84,9 @@ impl GitBitbucketDriver {
/// @inheritDoc
pub fn initialize(&mut self) -> anyhow::Result<()> {
- let Some(m) = preg_match2(
+ let Some(m) = preg_match(
php_regex!(r"#^https?://bitbucket\.org/([^/]+)/([^/]+?)(?:\.git|/?)?$#i"),
&self.inner.url,
- 0,
) else {
return Err(InvalidArgumentException::new(format!(
"The Bitbucket repository URL {} is invalid. It must be the HTTPS URL of a Bitbucket repository.",
@@ -798,10 +797,9 @@ impl GitBitbucketDriver {
url: &str,
_deep: bool,
) -> anyhow::Result<bool> {
- if preg_match2(
+ if preg_match(
php_regex!(r"#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)?$#i"),
url,
- 0,
)
.is_none()
{
diff --git a/crates/shirabe/src/repository/vcs/git_driver.rs b/crates/shirabe/src/repository/vcs/git_driver.rs
index 62cca379..63598517 100644
--- a/crates/shirabe/src/repository/vcs/git_driver.rs
+++ b/crates/shirabe/src/repository/vcs/git_driver.rs
@@ -16,7 +16,7 @@ use chrono::{DateTime, FixedOffset, Utc};
use indexmap::IndexMap;
use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
- InvalidArgumentException, RuntimeException, dirname, is_dir, is_writable, preg_match2,
+ InvalidArgumentException, RuntimeException, dirname, is_dir, is_writable, preg_match,
preg_replace, realpath, sys_get_temp_dir,
};
use shirabe_php_shim::{PhpMixed, php_regex};
@@ -98,13 +98,7 @@ impl GitDriver {
.into());
}
- if preg_match2(
- php_regex!(r"{^ssh://[^@]+@[^:]+:[^0-9]+}"),
- &self.inner.url,
- 0,
- )
- .is_some()
- {
+ if preg_match(php_regex!(r"{^ssh://[^@]+@[^:]+:[^0-9]+}"), &self.inner.url).is_some() {
return Err(InvalidArgumentException::new(format!(
"The source URL {} is invalid, ssh URLs should have a port number after \":\".\nUse ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.",
self.inner.url
@@ -204,7 +198,7 @@ impl GitDriver {
if !branches.contains(&"* master".to_string()) {
for branch in &branches {
if !branch.is_empty()
- && let Some(caps) = preg_match2(php_regex!(r"{^\* +(\S+)}"), branch, 0)
+ && let Some(caps) = preg_match(php_regex!(r"{^\* +(\S+)}"), branch)
&& let Some(name) = caps.get(1)
{
self.root_identifier = Some(name.to_string());
@@ -314,10 +308,9 @@ impl GitDriver {
);
for tag in self.inner.process.borrow().split_lines(&output) {
if !tag.is_empty()
- && let Some(caps) = preg_match2(
+ && let Some(caps) = preg_match(
php_regex!(r"{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}"),
&tag,
- 0,
)
&& let (Some(hash), Some(name)) = (caps.get(1), caps.get(2))
{
@@ -350,11 +343,10 @@ impl GitDriver {
);
for branch in self.inner.process.borrow().split_lines(&output) {
if !branch.is_empty()
- && preg_match2(php_regex!(r"{^ *[^/]+/HEAD }"), &branch, 0).is_none()
- && let Some(caps) = preg_match2(
+ && preg_match(php_regex!(r"{^ *[^/]+/HEAD }"), &branch).is_none()
+ && let Some(caps) = preg_match(
php_regex!(r"{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}"),
&branch,
- 0,
)
&& let (Some(name), Some(hash)) = (caps.get(1), caps.get(2))
&& !name.starts_with('-')
@@ -375,10 +367,9 @@ impl GitDriver {
url: &str,
deep: bool,
) -> anyhow::Result<bool> {
- if preg_match2(
+ if preg_match(
php_regex!(r"#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i"),
url,
- 0,
)
.is_some()
{
diff --git a/crates/shirabe/src/repository/vcs/github_driver.rs b/crates/shirabe/src/repository/vcs/github_driver.rs
index e9c17d30..f310da3d 100644
--- a/crates/shirabe/src/repository/vcs/github_driver.rs
+++ b/crates/shirabe/src/repository/vcs/github_driver.rs
@@ -18,7 +18,7 @@ use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
InvalidArgumentException, PhpMixed, RuntimeException, array_diff, array_map,
array_search_mixed, base64_decode, basename, empty, explode, extension_loaded, in_array_loose,
- parse_url, php_regex, preg_match2, preg_replace, preg_split, strpos, strtolower, substr, trim,
+ parse_url, php_regex, preg_match, preg_replace, preg_split, strpos, strtolower, substr, trim,
urlencode,
};
@@ -70,12 +70,11 @@ impl GitHubDriver {
}
pub fn initialize(&mut self) -> anyhow::Result<()> {
- let Some(match_) = preg_match2(
+ let Some(match_) = preg_match(
php_regex!(
r"#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/([^/]+?)(?:\.git|/)?$#"
),
&self.inner.url,
- 0,
) else {
return Err(InvalidArgumentException::new(format!(
"The GitHub repository URL {} is invalid.",
@@ -483,14 +482,14 @@ impl GitHubDriver {
let mut key: Option<String> = None;
for line in preg_split(php_regex!(r"{\r?\n}"), &funding) {
let line = trim(&line, None);
- if let Some(m) = preg_match2(php_regex!(r"{^(\w+)\s*:\s*(.+)$}"), &line, 0) {
+ if let Some(m) = preg_match(php_regex!(r"{^(\w+)\s*:\s*(.+)$}"), &line) {
let g1 = m.get(1).unwrap_or_default().to_string();
let g2 = m.get(2).unwrap_or_default().to_string();
if g2 == "[" {
key = Some(g1);
continue;
}
- if let Some(m2) = preg_match2(php_regex!(r"{^\[(.*?)\](?:\s*#.*)?$}"), &g2, 0) {
+ if let Some(m2) = preg_match(php_regex!(r"{^\[(.*?)\](?:\s*#.*)?$}"), &g2) {
let inner = m2.get(1).unwrap_or_default().to_string();
for item in array_map(
|s: &String| trim(s, None),
@@ -504,9 +503,7 @@ impl GitHubDriver {
);
result.push(entry);
}
- } else if let Some(m2) =
- preg_match2(php_regex!(r"{^([^#].*?)(?:\s+#.*)?$}"), &g2, 0)
- {
+ } else if let Some(m2) = preg_match(php_regex!(r"{^([^#].*?)(?:\s+#.*)?$}"), &g2) {
let mut entry = IndexMap::new();
entry.insert("type".to_string(), PhpMixed::String(g1.clone()));
entry.insert(
@@ -516,11 +513,11 @@ impl GitHubDriver {
result.push(entry);
}
key = None;
- } else if let Some(m) = preg_match2(php_regex!(r"{^(\w+)\s*:\s*#\s*$}"), &line, 0) {
+ } else if let Some(m) = preg_match(php_regex!(r"{^(\w+)\s*:\s*#\s*$}"), &line) {
key = Some(m.get(1).unwrap_or_default().to_string());
} else if key.is_some()
- && let Some(m) = preg_match2(php_regex!(r"{^-\s*(.+)(?:\s+#.*)?$}"), &line, 0)
- .or_else(|| preg_match2(php_regex!(r"{^(.+),(?:\s*#.*)?$}"), &line, 0))
+ && let Some(m) = preg_match(php_regex!(r"{^-\s*(.+)(?:\s+#.*)?$}"), &line)
+ .or_else(|| preg_match(php_regex!(r"{^(.+),(?:\s*#.*)?$}"), &line))
{
let mut entry = IndexMap::new();
entry.insert(
@@ -645,7 +642,7 @@ impl GitHubDriver {
};
if bits.scheme.is_none() && bits.host.is_none() {
- if preg_match2(php_regex!(r"{^[a-z0-9-]++\.[a-z]{2,3}$}"), &item_url, 0)
+ if preg_match(php_regex!(r"{^[a-z0-9-]++\.[a-z]{2,3}$}"), &item_url)
.is_some()
{
result[key_idx].insert(
@@ -911,12 +908,11 @@ impl GitHubDriver {
url: &str,
_deep: bool,
) -> anyhow::Result<bool> {
- let Some(matches) = preg_match2(
+ let Some(matches) = preg_match(
php_regex!(
r"#^((?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/([^/]+?)(?:\.git|/)?$#"
),
url,
- 0,
) else {
return Ok(false);
};
@@ -1253,7 +1249,7 @@ impl GitHubDriver {
let links = explode(",", &header);
for link in &links {
- if let Some(m) = preg_match2(php_regex!(r#"{<(.+?)>; *rel="next"}"#), link, 0) {
+ if let Some(m) = preg_match(php_regex!(r#"{<(.+?)>; *rel="next"}"#), link) {
return Some(m.get(1).unwrap_or_default().to_string());
}
}
diff --git a/crates/shirabe/src/repository/vcs/gitlab_driver.rs b/crates/shirabe/src/repository/vcs/gitlab_driver.rs
index 6054d941..229d043b 100644
--- a/crates/shirabe/src/repository/vcs/gitlab_driver.rs
+++ b/crates/shirabe/src/repository/vcs/gitlab_driver.rs
@@ -19,7 +19,7 @@ use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
InvalidArgumentException, LogicException, PhpMixed, RuntimeException, array_search_mixed,
array_shift, ctype_alnum, empty, explode, extension_loaded, implode, in_array_loose, is_array,
- is_string, ord, php_regex, preg_match2, preg_replace, strpos, strtolower,
+ is_string, ord, php_regex, preg_match, preg_replace, strpos, strtolower,
};
/// Driver for GitLab API, use the Git driver for local checkouts.
@@ -80,7 +80,7 @@ impl GitLabDriver {
///
/// SSH urls use https by default. Set "secure-http": false on the repository config to use http instead.
pub fn initialize(&mut self) -> anyhow::Result<()> {
- let Some(match_) = preg_match2(Self::URL_REGEX, &self.inner.url, 0) else {
+ let Some(match_) = preg_match(Self::URL_REGEX, &self.inner.url) else {
return Err(InvalidArgumentException::new(format!(
"The GitLab repository URL {} is invalid. It must be the HTTP URL of a GitLab project.",
self.inner.url.clone(),
@@ -382,7 +382,7 @@ impl GitLabDriver {
// Convert the root identifier to a cacheable commit id
let mut identifier = identifier.to_string();
- if preg_match2(php_regex!(r"{[a-f0-9]{40}}i"), &identifier, 0).is_none() {
+ if preg_match(php_regex!(r"{[a-f0-9]{40}}i"), &identifier).is_none() {
let branches = self.get_branches()?;
if let Some(sha) = branches.get(&identifier) {
identifier = sha.clone();
@@ -926,7 +926,7 @@ impl GitLabDriver {
url: &str,
_deep: bool,
) -> anyhow::Result<bool> {
- let Some(match_) = preg_match2(Self::URL_REGEX, url, 0) else {
+ let Some(match_) = preg_match(Self::URL_REGEX, url) else {
return Ok(false);
};
@@ -977,7 +977,7 @@ impl GitLabDriver {
let links = explode(",", &header);
for link in &links {
- if let Some(match_) = preg_match2(php_regex!(r#"{<(.+?)>; *rel="next"}"#), link, 0) {
+ if let Some(match_) = preg_match(php_regex!(r#"{<(.+?)>; *rel="next"}"#), link) {
return Some(match_.get(1).unwrap_or_default().to_string());
}
}
diff --git a/crates/shirabe/src/repository/vcs/hg_driver.rs b/crates/shirabe/src/repository/vcs/hg_driver.rs
index ada1063e..977d6b97 100644
--- a/crates/shirabe/src/repository/vcs/hg_driver.rs
+++ b/crates/shirabe/src/repository/vcs/hg_driver.rs
@@ -13,7 +13,7 @@ use chrono::{DateTime, FixedOffset, Utc};
use indexmap::IndexMap;
use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
- PhpMixed, RuntimeException, dirname, is_dir, is_writable, php_regex, preg_match2, preg_replace,
+ PhpMixed, RuntimeException, dirname, is_dir, is_writable, php_regex, preg_match, preg_replace,
};
#[derive(Debug)]
@@ -234,7 +234,7 @@ impl HgDriver {
);
for tag in self.inner.process.borrow().split_lines(&output) {
if !tag.is_empty()
- && let Some(m) = preg_match2(php_regex!(r"(^([^\s]+)\s+\d+:(.*)$)"), &tag, 0)
+ && let Some(m) = preg_match(php_regex!(r"(^([^\s]+)\s+\d+:(.*)$)"), &tag)
{
tags.insert(
m.get(1).unwrap_or_default().to_string(),
@@ -264,7 +264,7 @@ impl HgDriver {
for branch in self.inner.process.borrow().split_lines(&output) {
if !branch.is_empty()
&& let Some(m) =
- preg_match2(php_regex!(r"(^([^\s]+)\s+\d+:([a-f0-9]+))"), &branch, 0)
+ preg_match(php_regex!(r"(^([^\s]+)\s+\d+:([a-f0-9]+))"), &branch)
{
let name = m.get(1).unwrap_or_default().to_string();
if !name.starts_with('-') {
@@ -282,7 +282,7 @@ impl HgDriver {
for branch in self.inner.process.borrow().split_lines(&output) {
if !branch.is_empty()
&& let Some(m) =
- preg_match2(php_regex!(r"(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)"), &branch, 0)
+ preg_match(php_regex!(r"(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)"), &branch)
{
let name = m.get(1).unwrap_or_default().to_string();
if !name.starts_with('-') {
@@ -305,12 +305,11 @@ impl HgDriver {
url: &str,
deep: bool,
) -> anyhow::Result<bool> {
- if preg_match2(
+ if preg_match(
php_regex!(
r"#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i"
),
url,
- 0,
)
.is_some()
{
diff --git a/crates/shirabe/src/repository/vcs/perforce_driver.rs b/crates/shirabe/src/repository/vcs/perforce_driver.rs
index 50aed379..16dad1e9 100644
--- a/crates/shirabe/src/repository/vcs/perforce_driver.rs
+++ b/crates/shirabe/src/repository/vcs/perforce_driver.rs
@@ -9,9 +9,7 @@ use crate::util::PerforceInterface;
use crate::util::ProcessExecutor;
use crate::util::http::Response;
use indexmap::IndexMap;
-use shirabe_php_shim::{
- BadMethodCallException, PhpMixed, RuntimeException, php_regex, preg_match2,
-};
+use shirabe_php_shim::{BadMethodCallException, PhpMixed, RuntimeException, php_regex, preg_match};
#[derive(Debug)]
pub struct PerforceDriver {
@@ -190,7 +188,7 @@ impl PerforceDriver {
url: &str,
deep: bool,
) -> anyhow::Result<bool> {
- if deep || preg_match2(php_regex!(r"#\b(perforce|p4)\b#i"), url, 0).is_some() {
+ if deep || preg_match(php_regex!(r"#\b(perforce|p4)\b#i"), url).is_some() {
return Ok(Perforce::check_server_exists(
url,
&mut ProcessExecutor::new(Some(io)),
diff --git a/crates/shirabe/src/repository/vcs/svn_driver.rs b/crates/shirabe/src/repository/vcs/svn_driver.rs
index 3398eb59..28239452 100644
--- a/crates/shirabe/src/repository/vcs/svn_driver.rs
+++ b/crates/shirabe/src/repository/vcs/svn_driver.rs
@@ -15,7 +15,7 @@ use chrono::{DateTime, FixedOffset, Utc};
use indexmap::IndexMap;
use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
- PhpMixed, RuntimeException, php_regex, preg_match2, preg_replace, stripos, strrpos, strtr,
+ PhpMixed, RuntimeException, php_regex, preg_match, preg_replace, stripos, strrpos, strtr,
substr, trim,
};
@@ -153,7 +153,7 @@ impl SvnDriver {
}
fn should_cache(&self, identifier: &str) -> bool {
- self.inner.cache.is_some() && preg_match2(php_regex!(r"{@\d+$}"), identifier, 0).is_some()
+ self.inner.cache.is_some() && preg_match(php_regex!(r"{@\d+$}"), identifier).is_some()
}
pub fn get_composer_information(
@@ -257,8 +257,7 @@ impl SvnDriver {
) -> anyhow::Result<Option<String>> {
let identifier = format!("/{}/", trim(identifier, Some("/")));
- let (path, rev) = if let Some(m) =
- preg_match2(php_regex!(r"{^(.+?)(@\d+)?/$}"), &identifier, 0)
+ let (path, rev) = if let Some(m) = preg_match(php_regex!(r"{^(.+?)(@\d+)?/$}"), &identifier)
&& let Some(rev) = m.get(2)
{
(m.get(1).unwrap_or_default().to_string(), rev.to_string())
@@ -291,8 +290,7 @@ impl SvnDriver {
) -> anyhow::Result<Option<DateTime<FixedOffset>>> {
let identifier = format!("/{}/", trim(identifier, Some("/")));
- let (path, rev) = if let Some(m) =
- preg_match2(php_regex!(r"{^(.+?)(@\d+)?/$}"), &identifier, 0)
+ let (path, rev) = if let Some(m) = preg_match(php_regex!(r"{^(.+?)(@\d+)?/$}"), &identifier)
&& let Some(rev) = m.get(2)
{
(m.get(1).unwrap_or_default().to_string(), rev.to_string())
@@ -306,7 +304,7 @@ impl SvnDriver {
)?;
for line in self.inner.process.borrow().split_lines(&output) {
if !line.is_empty()
- && let Some(m) = preg_match2(php_regex!(r"{^Last Changed Date: ([^(]+)}"), &line, 0)
+ && let Some(m) = preg_match(php_regex!(r"{^Last Changed Date: ([^(]+)}"), &line)
{
let date_str = m.get(1).unwrap_or_default().to_string();
return Ok(shirabe_php_shim::date_create::<Utc>(date_str.trim())
@@ -334,7 +332,7 @@ impl SvnDriver {
let line = trim(&line, None);
if !line.is_empty()
&& let Some(m) =
- preg_match2(php_regex!(r"{^\s*(\S+).*?(\S+)\s*$}"), &line, 0)
+ preg_match(php_regex!(r"{^\s*(\S+).*?(\S+)\s*$}"), &line)
{
let rev: i64 = m.get(1).and_then(|s| s.parse().ok()).unwrap_or(0);
let path = m.get(2).unwrap_or_default().to_string();
@@ -376,8 +374,7 @@ impl SvnDriver {
for line in self.inner.process.borrow().split_lines(&output) {
let line = trim(&line, None);
if !line.is_empty()
- && let Some(m) =
- preg_match2(php_regex!(r"{^\s*(\S+).*?(\S+)\s*$}"), &line, 0)
+ && let Some(m) = preg_match(php_regex!(r"{^\s*(\S+).*?(\S+)\s*$}"), &line)
{
let rev: i64 = m.get(1).and_then(|s| s.parse().ok()).unwrap_or(0);
let path = m.get(2).unwrap_or_default().to_string();
@@ -412,7 +409,7 @@ impl SvnDriver {
let line = trim(&line, None);
if !line.is_empty()
&& let Some(m) =
- preg_match2(php_regex!(r"{^\s*(\S+).*?(\S+)\s*$}"), &line, 0)
+ preg_match(php_regex!(r"{^\s*(\S+).*?(\S+)\s*$}"), &line)
{
let rev: i64 = m.get(1).and_then(|s| s.parse().ok()).unwrap_or(0);
let path = m.get(2).unwrap_or_default().to_string();
@@ -443,7 +440,7 @@ impl SvnDriver {
deep: bool,
) -> anyhow::Result<bool> {
let url = Self::normalize_url(url);
- if preg_match2(php_regex!(r"#(^svn://|^svn\+ssh://|svn\.)#i"), &url, 0).is_some() {
+ if preg_match(php_regex!(r"#(^svn://|^svn\+ssh://|svn\.)#i"), &url).is_some() {
return Ok(true);
}
diff --git a/crates/shirabe/src/repository/vcs/vcs_driver.rs b/crates/shirabe/src/repository/vcs/vcs_driver.rs
index 1a5ee72e..439275f1 100644
--- a/crates/shirabe/src/repository/vcs/vcs_driver.rs
+++ b/crates/shirabe/src/repository/vcs/vcs_driver.rs
@@ -13,7 +13,7 @@ use crate::util::http::Response;
use chrono::{DateTime, FixedOffset};
use indexmap::IndexMap;
use shirabe_php_shim::Catch as _;
-use shirabe_php_shim::{DATE_RFC3339, PhpMixed, extension_loaded, php_regex, preg_match2};
+use shirabe_php_shim::{DATE_RFC3339, PhpMixed, extension_loaded, php_regex, preg_match};
#[derive(Debug)]
pub struct VcsDriverBase {
@@ -56,8 +56,7 @@ impl VcsDriverBase {
}
pub fn should_cache(&self, identifier: &str) -> bool {
- self.cache.is_some()
- && preg_match2(php_regex!("{^[a-f0-9]{40}$}iD"), identifier, 0).is_some()
+ self.cache.is_some() && preg_match(php_regex!("{^[a-f0-9]{40}$}iD"), identifier).is_some()
}
pub fn get_scheme(&self) -> &str {
@@ -202,8 +201,7 @@ pub trait VcsDriver: VcsDriverInterface {
fn cache_mut(&mut self) -> Option<&mut Cache>;
fn should_cache(&self, identifier: &str) -> bool {
- self.cache().is_some()
- && preg_match2(php_regex!("{^[a-f0-9]{40}$}iD"), identifier, 0).is_some()
+ self.cache().is_some() && preg_match(php_regex!("{^[a-f0-9]{40}$}iD"), identifier).is_some()
}
fn get_composer_information(