更名文件夹objects->models,并增添index.rs结构

This commit is contained in:
mrbeanc
2023-12-18 13:42:29 +08:00
parent f55ab0e7a6
commit af5e36c24c
10 changed files with 53 additions and 5 deletions

17
src/models/tree.rs Normal file
View File

@@ -0,0 +1,17 @@
use super::object::Hash;
/*Tree
* Tree是一个版本中所有文件的集合。从根目录还是每个目录是一个Tree每个文件是一个Blob。Tree之间互相嵌套表示文件的层级关系。
* 每一个Tree对象也是对应到git储存仓库的一个文件其内容是一个或多个TreeEntry。
*/
#[derive(Debug, Clone)]
pub struct TreeEntry {
pub filemode: (String, String), // (type, mode), type: blob or tree; mode: 100644 or 04000
pub hash: Hash, // blob hash or tree hash
pub name: String, // file name
}
#[derive(Debug, Clone)]
pub struct Tree {
pub hash: Hash,
pub entries: Vec<TreeEntry>,
}