aboutsummaryrefslogtreecommitdiff
path: root/src/app/worktrees.rs
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-08-28 18:25:07 +0300
committerGitHub <noreply@github.com>2026-08-28 18:25:07 +0300
commit095f1337d6502081658973ae3487dee8c6b34e1a (patch)
tree4174cac82dd51dabcc1fcef57b45df2462ef1918 /src/app/worktrees.rs
parent13a9f6402fb77a31499bf758b56ca42b79936706 (diff)
fix: trust worktree repositories per request (#3344)
refs #3044
Diffstat (limited to 'src/app/worktrees.rs')
-rw-r--r--src/app/worktrees.rs35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/app/worktrees.rs b/src/app/worktrees.rs
index 414d74b5..9993a70e 100644
--- a/src/app/worktrees.rs
+++ b/src/app/worktrees.rs
@@ -161,7 +161,7 @@ impl App {
}
};
- let list = match crate::worktree::list_existing_worktrees(&space.repo_root) {
+ let list = match crate::worktree::list_existing_worktrees(&space.repo_root, false) {
Ok(list) => list,
Err(err) => {
self.state.config_diagnostic = Some(err);
@@ -551,6 +551,7 @@ impl App {
&path,
&branch,
"HEAD",
+ false,
)
});
let _ = event_tx.blocking_send(AppEvent::WorktreeAddFinished(Box::new(
@@ -599,6 +600,7 @@ impl App {
base: Some("HEAD".into()),
focus: true,
label: None,
+ trust_repository: false,
},
);
if let Some(message) = immediate_api_error_message(immediate_response.as_deref()) {
@@ -641,7 +643,8 @@ impl App {
}
#[cfg(windows)]
if !remove.force_confirmation
- && crate::worktree::checkout_has_dirty_files(&remove.path).unwrap_or(false)
+ && crate::worktree::checkout_has_dirty_files(&remove.path, false)
+ .unwrap_or(false)
{
remove.force_confirmation = true;
remove.error = None;
@@ -686,12 +689,13 @@ impl App {
})
.unwrap_or((None, None));
- let command = crate::worktree::build_worktree_remove_command(&repo_root, &path, force);
+ let command =
+ crate::worktree::build_worktree_remove_command(&repo_root, &path, force, false);
tracing::info!(workspace_id = %workspace_id, path = %path.display(), force, "starting git worktree remove");
let event_tx = self.event_tx.clone();
std::thread::spawn(move || {
let result = crate::worktree::run_worktree_remove_command_with_recovery(
- &command, &repo_root, &path, force,
+ &command, &repo_root, &path, force, false,
);
let _ = event_tx.blocking_send(AppEvent::WorktreeRemoveFinished(Box::new(
WorktreeRemoveResult {
@@ -728,6 +732,7 @@ impl App {
branch: None,
focus: true,
label: None,
+ trust_repository: false,
},
);
if serde_json::from_str::<crate::api::schema::SuccessResponse>(&response).is_ok() {
@@ -751,7 +756,7 @@ impl App {
}
#[cfg(windows)]
if !remove.force_confirmation
- && crate::worktree::checkout_has_dirty_files(&remove.path).unwrap_or(false)
+ && crate::worktree::checkout_has_dirty_files(&remove.path, false).unwrap_or(false)
{
remove.force_confirmation = true;
remove.error = None;
@@ -767,6 +772,7 @@ impl App {
crate::api::schema::WorktreeRemoveParams {
workspace_id,
force,
+ trust_repository: false,
},
);
if let Some(message) = immediate_api_error_message(immediate_response.as_deref()) {
@@ -1831,7 +1837,7 @@ mod tests {
}));
shutdown_test_runtimes(&mut app);
- let remove = crate::worktree::build_worktree_remove_command(&repo, &checkout, false);
+ let remove = crate::worktree::build_worktree_remove_command(&repo, &checkout, false, false);
crate::worktree::run_worktree_command(&remove).unwrap();
let _ = std::fs::remove_dir_all(worktree_root);
let _ = std::fs::remove_dir_all(repo);
@@ -1929,7 +1935,7 @@ mod tests {
}
assert!(checkout.join("README.md").exists());
- let remove = crate::worktree::build_worktree_remove_command(&repo, &checkout, false);
+ let remove = crate::worktree::build_worktree_remove_command(&repo, &checkout, false, false);
crate::worktree::run_worktree_command(&remove).unwrap();
let _ = std::fs::remove_dir_all(worktree_root);
let _ = std::fs::remove_dir_all(repo);
@@ -1988,7 +1994,7 @@ mod tests {
branch
);
- let remove = crate::worktree::build_worktree_remove_command(&repo, &checkout, false);
+ let remove = crate::worktree::build_worktree_remove_command(&repo, &checkout, false, false);
crate::worktree::run_worktree_command(&remove).unwrap();
let _ = std::fs::remove_dir_all(worktree_root);
let _ = std::fs::remove_dir_all(repo);
@@ -2036,8 +2042,12 @@ mod tests {
}
assert!(checkout.join("README.md").exists());
- let remove_new =
- crate::worktree::build_worktree_remove_command(&source_checkout_path, &checkout, false);
+ let remove_new = crate::worktree::build_worktree_remove_command(
+ &source_checkout_path,
+ &checkout,
+ false,
+ false,
+ );
crate::worktree::run_worktree_command(&remove_new).unwrap();
let _ = std::fs::remove_dir_all(worktree_root);
let _ = std::fs::remove_dir_all(source_checkout_path);
@@ -2096,10 +2106,11 @@ mod tests {
}
assert!(checkout.join("SOURCE.md").exists());
- let remove_new = crate::worktree::build_worktree_remove_command(&repo, &checkout, false);
+ let remove_new =
+ crate::worktree::build_worktree_remove_command(&repo, &checkout, false, false);
crate::worktree::run_worktree_command(&remove_new).unwrap();
let remove_source =
- crate::worktree::build_worktree_remove_command(&repo, &source_checkout, false);
+ crate::worktree::build_worktree_remove_command(&repo, &source_checkout, false, false);
crate::worktree::run_worktree_command(&remove_source).unwrap();
let _ = std::fs::remove_dir_all(worktree_root);
let _ = std::fs::remove_dir_all(repo);