Skip to content

Commit

Permalink
delete index db when deleting repository (#70)
Browse files Browse the repository at this point in the history
* delete index db when deleting repository

* better warning message

Co-authored-by: Onur Özkan <[email protected]>

---------

Co-authored-by: Onur Özkan <[email protected]>
  • Loading branch information
erklyn and onur-ozkan authored Feb 18, 2024
1 parent f4adc7c commit 63beb68
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lpm/core/src/repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ pub fn delete_repositories(

info!("Deleting list of repositories: {:?}", repository_names);
db::delete_repositories(&ctx.core_db, repository_names.to_vec())?;
repository_names.iter().for_each(|repository| {
if let Err(err) = fs::remove_file(Path::new(REPOSITORY_INDEX_DB_DIR).join(repository)) {
warning!(
"Couldn't clean the index database of {}. Reason: {}",
repository,
err
)
}
});

Ok(())
}
Expand Down

0 comments on commit 63beb68

Please sign in to comment.