aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository/vcs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-24 21:10:48 +0900
committernsfisis <nsfisis@gmail.com>2026-06-24 21:11:03 +0900
commita8f115666344abe3b606a4a65595ca301e7ac08a (patch)
tree9af244392d41542fae74ceab1be0b8fb473bdd46 /crates/shirabe/src/repository/vcs
parent6dcc2125974e350d1844c5ce1bb3562e224f3435 (diff)
downloadphp-shirabe-a8f115666344abe3b606a4a65595ca301e7ac08a.tar.gz
php-shirabe-a8f115666344abe3b606a4a65595ca301e7ac08a.tar.zst
php-shirabe-a8f115666344abe3b606a4a65595ca301e7ac08a.zip
refactor(process): take cwd as Option<&str> instead of IntoExecCwd
Replace the generic cwd parameter backed by the IntoExecCwd trait with a concrete Option<&str> across execute/execute_args/execute_tty/execute_async. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/repository/vcs')
-rw-r--r--crates/shirabe/src/repository/vcs/fossil_driver.rs20
-rw-r--r--crates/shirabe/src/repository/vcs/git_driver.rs19
-rw-r--r--crates/shirabe/src/repository/vcs/hg_driver.rs27
-rw-r--r--crates/shirabe/src/repository/vcs/svn_driver.rs2
4 files changed, 33 insertions, 35 deletions
diff --git a/crates/shirabe/src/repository/vcs/fossil_driver.rs b/crates/shirabe/src/repository/vcs/fossil_driver.rs
index 1da7a2a..ebc0ac4 100644
--- a/crates/shirabe/src/repository/vcs/fossil_driver.rs
+++ b/crates/shirabe/src/repository/vcs/fossil_driver.rs
@@ -103,7 +103,7 @@ impl FossilDriver {
if self.inner.process.borrow_mut().execute_args(
["fossil", "version"].map(|s| s.to_string()).as_ref(),
&mut ignored_output,
- (),
+ None,
) != 0
{
return Err(RuntimeException {
@@ -143,13 +143,13 @@ impl FossilDriver {
&& self.inner.process.borrow_mut().execute_args(
["fossil", "info"].map(|s| s.to_string()).as_ref(),
&mut String::new(),
- Some(self.checkout_dir.clone()),
+ Some(&self.checkout_dir),
) == 0
{
if self.inner.process.borrow_mut().execute_args(
["fossil", "pull"].map(|s| s.to_string()).as_ref(),
&mut String::new(),
- Some(self.checkout_dir.clone()),
+ Some(&self.checkout_dir),
) != 0
{
self.inner.io.write_error3(&format!(
@@ -170,7 +170,7 @@ impl FossilDriver {
.map(|s| s.to_string())
.as_ref(),
&mut output,
- (),
+ None,
) != 0
{
let output = self.inner.process.borrow().get_error_output().to_string();
@@ -189,7 +189,7 @@ impl FossilDriver {
.map(|s| s.to_string())
.as_ref(),
&mut output,
- Some(self.checkout_dir.clone()),
+ Some(&self.checkout_dir),
) != 0
{
let output = self.inner.process.borrow().get_error_output().to_string();
@@ -248,7 +248,7 @@ impl FossilDriver {
.map(|s| s.to_string())
.as_ref(),
&mut content,
- Some(self.checkout_dir.clone()),
+ Some(&self.checkout_dir),
);
if content.trim().is_empty() {
@@ -268,7 +268,7 @@ impl FossilDriver {
.map(|s| s.to_string())
.as_ref(),
&mut output,
- Some(self.checkout_dir.clone()),
+ Some(&self.checkout_dir),
);
let parts: Vec<&str> = output.trim().splitn(3, ' ').collect();
let date = parts.get(1).copied().unwrap_or("");
@@ -284,7 +284,7 @@ impl FossilDriver {
self.inner.process.borrow_mut().execute_args(
["fossil", "tag", "list"].map(|s| s.to_string()).as_ref(),
&mut output,
- Some(self.checkout_dir.clone()),
+ Some(&self.checkout_dir),
);
for tag in self.inner.process.borrow().split_lines(&output) {
tags.insert(tag.clone(), tag);
@@ -301,7 +301,7 @@ impl FossilDriver {
self.inner.process.borrow_mut().execute_args(
["fossil", "branch", "list"].map(|s| s.to_string()).as_ref(),
&mut output,
- Some(self.checkout_dir.clone()),
+ Some(&self.checkout_dir),
);
for branch in self.inner.process.borrow().split_lines(&output) {
let branch = Preg::replace(r"/^\*/", "", branch.trim());
@@ -342,7 +342,7 @@ impl FossilDriver {
if process.execute_args(
["fossil", "info"].map(|s| s.to_string()).as_ref(),
&mut output,
- Some(url),
+ Some(&url),
) == 0
{
return Ok(true);
diff --git a/crates/shirabe/src/repository/vcs/git_driver.rs b/crates/shirabe/src/repository/vcs/git_driver.rs
index e639649..37f393c 100644
--- a/crates/shirabe/src/repository/vcs/git_driver.rs
+++ b/crates/shirabe/src/repository/vcs/git_driver.rs
@@ -208,7 +208,7 @@ impl GitDriver {
"--no-color".to_string(),
],
&mut output,
- Some(self.repo_dir.clone()),
+ Some(&self.repo_dir),
);
let branches = self.inner.process.borrow().split_lines(&output);
if !branches.contains(&"* master".to_string()) {
@@ -269,7 +269,7 @@ impl GitDriver {
format!("{}:{}", identifier, file),
],
&mut content,
- Some(self.repo_dir.clone()),
+ Some(&self.repo_dir),
);
if content.trim().is_empty() {
@@ -303,11 +303,10 @@ impl GitDriver {
],
);
let mut output = String::new();
- self.inner.process.borrow_mut().execute_args(
- &command,
- &mut output,
- Some(self.repo_dir.clone()),
- );
+ self.inner
+ .process
+ .borrow_mut()
+ .execute_args(&command, &mut output, Some(&self.repo_dir));
let timestamp_str = GitUtil::parse_rev_list_output(&output, &self.inner.process);
let timestamp: i64 = timestamp_str.trim().parse().unwrap_or(0);
@@ -329,7 +328,7 @@ impl GitDriver {
"--dereference".to_string(),
],
&mut output,
- Some(self.repo_dir.clone()),
+ Some(&self.repo_dir),
);
for tag in self.inner.process.borrow().split_lines(&output) {
if !tag.is_empty() {
@@ -368,7 +367,7 @@ impl GitDriver {
"-v".to_string(),
],
&mut output,
- Some(self.repo_dir.clone()),
+ Some(&self.repo_dir),
);
for branch in self.inner.process.borrow().split_lines(&output) {
if !branch.is_empty() && !Preg::is_match(r"{^ *[^/]+/HEAD }", &branch) {
@@ -419,7 +418,7 @@ impl GitDriver {
if process.borrow_mut().execute_args(
&["git".to_string(), "tag".to_string()],
&mut output,
- Some(url.clone()),
+ Some(&url),
) == 0
{
return Ok(true);
diff --git a/crates/shirabe/src/repository/vcs/hg_driver.rs b/crates/shirabe/src/repository/vcs/hg_driver.rs
index 737443c..3ae87d1 100644
--- a/crates/shirabe/src/repository/vcs/hg_driver.rs
+++ b/crates/shirabe/src/repository/vcs/hg_driver.rs
@@ -93,13 +93,13 @@ impl HgDriver {
&& self.inner.process.borrow_mut().execute_args(
["hg", "summary"].map(|s| s.to_string()).as_ref(),
&mut String::new(),
- Some(self.repo_dir.clone()),
+ Some(&self.repo_dir),
) == 0
{
if self.inner.process.borrow_mut().execute_args(
["hg", "pull"].map(|s| s.to_string()).as_ref(),
&mut String::new(),
- Some(self.repo_dir.clone()),
+ Some(&self.repo_dir),
) != 0
{
self.inner.io.write_error3(&format!("<error>Failed to update {}, package information from this repository may be outdated ({})</error>", self.inner.url, self.inner.process.borrow().get_error_output()), true, crate::io::NORMAL);
@@ -138,7 +138,7 @@ impl HgDriver {
.map(|s| s.to_string())
.as_ref(),
&mut output,
- Some(self.repo_dir.clone()),
+ Some(&self.repo_dir),
);
let lines = self.inner.process.borrow().split_lines(&output);
self.root_identifier = lines.into_iter().next();
@@ -184,11 +184,10 @@ impl HgDriver {
file.to_string(),
];
let mut content = String::new();
- self.inner.process.borrow_mut().execute_args(
- &resource,
- &mut content,
- Some(self.repo_dir.clone()),
- );
+ self.inner
+ .process
+ .borrow_mut()
+ .execute_args(&resource, &mut content, Some(&self.repo_dir));
if content.trim().is_empty() {
return Ok(None);
@@ -225,7 +224,7 @@ impl HgDriver {
.map(|s| s.to_string())
.as_ref(),
&mut output,
- Some(self.repo_dir.clone()),
+ Some(&self.repo_dir),
);
let date: DateTime<Utc> = shirabe_php_shim::date_create(output.trim())?;
@@ -239,7 +238,7 @@ impl HgDriver {
self.inner.process.borrow_mut().execute_args(
["hg", "tags"].map(|s| s.to_string()).as_ref(),
&mut output,
- Some(self.repo_dir.clone()),
+ Some(&self.repo_dir),
);
for tag in self.inner.process.borrow().split_lines(&output) {
if !tag.is_empty() {
@@ -269,7 +268,7 @@ impl HgDriver {
self.inner.process.borrow_mut().execute_args(
["hg", "branches"].map(|s| s.to_string()).as_ref(),
&mut output,
- Some(self.repo_dir.clone()),
+ Some(&self.repo_dir),
);
for branch in self.inner.process.borrow().split_lines(&output) {
if !branch.is_empty() {
@@ -290,7 +289,7 @@ impl HgDriver {
self.inner.process.borrow_mut().execute_args(
["hg", "bookmarks"].map(|s| s.to_string()).as_ref(),
&mut output,
- Some(self.repo_dir.clone()),
+ Some(&self.repo_dir),
);
for branch in self.inner.process.borrow().split_lines(&output) {
if !branch.is_empty() {
@@ -339,7 +338,7 @@ impl HgDriver {
if process.execute_args(
["hg", "summary"].map(|s| s.to_string()).as_ref(),
&mut output,
- Some(url),
+ Some(&url),
) == 0
{
return Ok(true);
@@ -357,7 +356,7 @@ impl HgDriver {
.map(|s| s.to_string())
.as_ref(),
&mut ignored,
- (),
+ None,
);
Ok(exit == 0)
diff --git a/crates/shirabe/src/repository/vcs/svn_driver.rs b/crates/shirabe/src/repository/vcs/svn_driver.rs
index e68beb6..19aec03 100644
--- a/crates/shirabe/src/repository/vcs/svn_driver.rs
+++ b/crates/shirabe/src/repository/vcs/svn_driver.rs
@@ -495,7 +495,7 @@ impl SvnDriver {
url.clone(),
],
&mut ignored_output,
- (),
+ None,
);
if exit == 0 {