mirror of
https://codeberg.org/icewind/haze.git
synced 2026-10-01 08:44:09 +02:00
fix cleaning up worktree if there are no worktrees
This commit is contained in:
parent
3a8300110a
commit
c5c2bdbf50
1 changed files with 7 additions and 2 deletions
|
|
@ -105,7 +105,11 @@ async fn creates_worktrees_for_instance(
|
|||
async fn remove_worktrees_for_instance(config: &HazeConfig, id: &str) -> Result<()> {
|
||||
let worktree_dir = config.worktree_dir.join(id);
|
||||
|
||||
remove_worktree(&worktree_dir)?;
|
||||
if !worktree_dir.exists() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
remove_worktree(&worktree_dir).wrap_err("Failed to remove worktree for server")?;
|
||||
|
||||
for app_dir in &config.app_directories {
|
||||
let Some(dir_name) = app_dir.file_name() else {
|
||||
|
|
@ -115,7 +119,8 @@ async fn remove_worktrees_for_instance(config: &HazeConfig, id: &str) -> Result<
|
|||
continue;
|
||||
};
|
||||
for app_worktree in app_worktrees.flatten() {
|
||||
remove_worktree(app_worktree.path())?;
|
||||
remove_worktree(app_worktree.path())
|
||||
.wrap_err_with(|| format!("Failed to remove worktree for {dir_name}"))?;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue