mirror of
https://github.com/MrBeanCpp/MIT.git
synced 2026-04-09 13:49:59 +08:00
优化switch报错
This commit is contained in:
@@ -32,9 +32,11 @@ fn switch_to_commit(commit_hash: Hash) {
|
||||
fn switch_to(branch: String, detach: bool) -> Result<(), SwitchErr> {
|
||||
// 检查更改
|
||||
if !status::changes_to_be_staged().is_empty() {
|
||||
status::status();
|
||||
println!("fatal: 你有未暂存的更改,切换分支会导致更改丢失");
|
||||
return Err(SwitchErr::NoClean);
|
||||
} else if !status::changes_to_be_committed().is_empty() {
|
||||
status::status();
|
||||
println!("fatal: 你有未提交的更改,无法切换分支");
|
||||
return Err(SwitchErr::NoClean);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user