将当前的head指向commit_hash,根据当前的head类型,更新不同的文件 */
(commit_hash: &String)
| 65 | |
| 66 | /** 将当前的head指向commit_hash,根据当前的head类型,更新不同的文件 */ |
| 67 | pub fn update_head_commit(commit_hash: &String) { |
| 68 | let head = current_head(); |
| 69 | match head { |
| 70 | Head::Branch(branch_name) => { |
| 71 | update_branch(&branch_name, commit_hash); |
| 72 | } |
| 73 | Head::Detached(_) => { |
| 74 | let mut head = util::get_storage_path().unwrap(); |
| 75 | head.push("HEAD"); |
| 76 | std::fs::write(head, commit_hash).expect("无法写入HEAD"); |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | /** 列出本地的branch */ |
| 82 | pub fn list_local_branches() -> Vec<String> { |
no test coverage detected