Revert "setup_test_with_clean_mit() 会清理文件"

This reverts commit 13aa7452de.
This commit is contained in:
HouXiaoxuan
2023-12-23 10:23:54 +08:00
parent f8da30b7d8
commit 055dc49f52
2 changed files with 1 additions and 10 deletions

View File

@@ -71,6 +71,7 @@ impl Store {
let mut path = self.store_path.clone();
path.push("objects");
path.push(&hash);
println!("Saved to: [{}]", path.display());
match std::fs::write(path, content) {
Ok(_) => hash,
Err(_) => panic!("储存库疑似损坏,无法写入文件"),

View File

@@ -52,9 +52,6 @@ pub fn setup_test_with_mit() {
pub fn setup_test_with_clean_mit() {
setup_test_without_mit();
let _ = crate::commands::init::init();
list_workdir_files().iter().for_each(|path| {
fs::remove_file(path).unwrap();
});
}
pub fn setup_test_without_mit() {
@@ -80,13 +77,6 @@ pub fn ensure_test_file(path: &Path, content: option::Option<&str>) {
}
}
pub fn ensure_no_file(path: &Path) {
// 以测试目录为根目录,删除文件
if path.exists() {
fs::remove_file(get_working_dir().unwrap().join(path)).unwrap();
}
}
/* tools for mit */
pub fn calc_hash(data: &String) -> String {
let mut hasher = Sha1::new();