empty-descriptions-and-dropped-worktrees #15
1 changed files with 17 additions and 2 deletions
19
src/git.rs
19
src/git.rs
|
|
@ -20,9 +20,24 @@ pub struct Worktree {
|
||||||
|
|
||||||
impl Drop for Worktree {
|
impl Drop for Worktree {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
let _result = std::process::Command::new("git")
|
let result = std::process::Command::new("git")
|
||||||
.args(["worktree", "remove", &self.path.path().to_string_lossy()])
|
.args([
|
||||||
|
"worktree",
|
||||||
|
"remove",
|
||||||
|
"--force",
|
||||||
|
&self.path.path().to_string_lossy(),
|
||||||
|
])
|
||||||
.output();
|
.output();
|
||||||
|
match result {
|
||||||
|
Err(e) => {
|
||||||
|
println!("failed to run git: {:#?}", e);
|
||||||
|
}
|
||||||
|
Ok(result) => {
|
||||||
|
if !result.status.success() {
|
||||||
|
println!("failed to remove git worktree: {:#?}", result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue