实现Index析构自动保存:Drop for Index

This commit is contained in:
mrbeanc
2023-12-21 17:12:03 +08:00
parent 1d6e648120
commit ffefd7f981
3 changed files with 15 additions and 3 deletions

View File

@@ -42,8 +42,6 @@ pub fn add(files: Vec<String>, all: bool, mut update: bool) {
for file in &files {
add_a_file(file, &mut index);
}
index.save();
}
fn add_a_file(file: &Path, index: &mut Index) {

View File

@@ -65,6 +65,10 @@ pub fn changes_to_be_committed() -> Changes {
change
}
pub fn changes_to_be_staged() {
unimplemented!()
}
/** 分为两个部分
1. unstaged: 暂存区与工作区比较
2. staged to be committed: 暂存区与HEAD(最后一次Commit::Tree)比较,即上次的暂存区