This commit is contained in:
HouXiaoxuan
2023-12-19 23:11:42 +08:00
parent 3d552014c2
commit 6616e98109
2 changed files with 30 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
use super::object::Hash;
use super::{index::Index, object::Hash};
/*Commit
* git中版本控制的单位。
* 一份Commit中对应一份版Tree记录了该版本所包含的文件parent记录本次commit的来源形成了版本树
@@ -13,3 +13,17 @@ pub struct Commit {
parent: Vec<Hash>, // parents commit hash
tree: String, // tree hash
}
impl Commit {
pub fn new(index: &Index, parent: Vec<Hash>, message: String) -> Commit {
unimplemented!()
}
pub fn load(hash: &String) -> Commit {
unimplemented!()
}
pub fn save(&self) {
unimplemented!()
}
}

View File

@@ -1,4 +1,4 @@
use super::object::Hash;
use super::{index::Index, object::Hash};
/*Tree
* Tree是一个版本中所有文件的集合。从根目录还是每个目录是一个Tree每个文件是一个Blob。Tree之间互相嵌套表示文件的层级关系。
* 每一个Tree对象也是对应到git储存仓库的一个文件其内容是一个或多个TreeEntry。
@@ -15,3 +15,17 @@ pub struct Tree {
pub hash: Hash,
pub entries: Vec<TreeEntry>,
}
impl Tree {
pub fn new(index: &Index) -> Tree {
unimplemented!()
}
pub fn load(hash: &String) -> Tree {
unimplemented!()
}
pub fn save(&self) {
unimplemented!()
}
}