mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2025-01-02 06:25:02 +03:00
project deleteion cleans up virtual_branches.toml
This commit is contained in:
parent
65f2dc1fa5
commit
bb48dff72a
@ -261,10 +261,9 @@ impl Controller {
|
||||
tracing::error!(project_id = %project.id, ?error, "failed to remove .git/gitbutler.json data",);
|
||||
}
|
||||
|
||||
let virtual_branches_path = project.path.join(".git/virtual_branches.toml");
|
||||
if virtual_branches_path.exists() {
|
||||
if let Err(error) = std::fs::remove_file(virtual_branches_path) {
|
||||
tracing::error!(project_id = %project.id, ?error, "failed to remove .git/virtual_branches.toml data",);
|
||||
if project.gb_dir().exists() {
|
||||
if let Err(error) = std::fs::remove_dir_all(project.gb_dir()) {
|
||||
tracing::error!(project_id = %project.id, ?error, "failed to remove {:?} on project delete", project.gb_dir());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,3 +114,19 @@ mod add {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mod delete {
|
||||
use super::*;
|
||||
#[tokio::test]
|
||||
async fn success() {
|
||||
let (controller, _tmp) = new();
|
||||
let repository = gitbutler_testsupport::TestProject::default();
|
||||
let path = repository.path();
|
||||
let project = controller.add(path).unwrap();
|
||||
assert!(controller.delete(&project.id).await.is_ok());
|
||||
assert!(controller.delete(&project.id).await.is_ok()); // idempotent
|
||||
assert!(controller.get(&project.id).is_err());
|
||||
assert!(!project.gb_dir().exists());
|
||||
assert!(!project.path.join(".gitbutler.json").exists());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user