mirror of
https://github.com/MrBeanCpp/MIT.git
synced 2026-04-09 05:38:28 +08:00
TODO
This commit is contained in:
@@ -58,6 +58,7 @@ mod test {
|
||||
assert!(head_one.is_empty());
|
||||
|
||||
util::ensure_test_file(&Path::new(test_file), "test content".into());
|
||||
commands::add::add(vec![], true, false);
|
||||
commands::commit::commit("test commit 1".to_string(), true);
|
||||
let head_two = head::current_head_commit();
|
||||
assert!(head_two.len() > 0);
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
use std::{collections::HashMap, path::PathBuf};
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
path::PathBuf,
|
||||
};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -37,7 +40,7 @@ fn store_path_to_tree(index: &Index, current_root: PathBuf) -> Tree {
|
||||
entry
|
||||
};
|
||||
let mut tree = Tree { hash: "".to_string(), entries: Vec::new() };
|
||||
let mut processed_path: HashMap<String, bool> = HashMap::new();
|
||||
let mut processed_path: HashSet<String> = HashSet::new();
|
||||
let path_entries = index
|
||||
.get_tracked_files()
|
||||
.iter()
|
||||
@@ -56,9 +59,14 @@ fn store_path_to_tree(index: &Index, current_root: PathBuf) -> Tree {
|
||||
}
|
||||
// 拿到下一级别目录
|
||||
let process_path = path.components().nth(0).unwrap().as_os_str().to_str().unwrap();
|
||||
if processed_path.insert(process_path.to_string(), true).is_some() {
|
||||
// if processed_path.insert(process_path.to_string(), true).is_some() {
|
||||
// continue;
|
||||
// }
|
||||
// TODO 函数整体逻辑错误,等待修复@houxiaoxuan
|
||||
if processed_path.contains(process_path) {
|
||||
continue;
|
||||
}
|
||||
processed_path.insert(process_path.to_string());
|
||||
|
||||
let sub_tree = store_path_to_tree(index, process_path.into());
|
||||
let mode = util::get_file_mode(&util::get_working_dir().unwrap().join(process_path));
|
||||
@@ -160,7 +168,7 @@ mod test {
|
||||
fn test_new() {
|
||||
util::setup_test_with_clean_mit();
|
||||
let mut index = super::Index::new();
|
||||
for test_file in vec!["b.txt", "mit_src/a.txt"] {
|
||||
for test_file in vec!["b.txt", "mit_src/a.txt", "test/test.txt"] {
|
||||
let test_file = PathBuf::from(test_file);
|
||||
util::ensure_test_file(&test_file, None);
|
||||
index.add(test_file.clone(), FileMetaData::new(&Blob::new(&test_file), &test_file));
|
||||
|
||||
Reference in New Issue
Block a user