mirror of
https://github.com/MrBeanCpp/MIT.git
synced 2026-02-09 13:15:00 +08:00
优化commit显示
This commit is contained in:
@@ -3,7 +3,8 @@ use crate::models::{commit, index};
|
||||
|
||||
use super::status;
|
||||
|
||||
fn no_change() -> bool { //todo: move to status.rs
|
||||
fn no_change() -> bool {
|
||||
//todo: move to status.rs
|
||||
let change = status::changes_to_be_committed();
|
||||
change.new.len() == 0 && change.modified.len() == 0 && change.deleted.len() == 0
|
||||
}
|
||||
@@ -21,16 +22,18 @@ pub fn commit(message: String, allow_empty: bool) {
|
||||
let commit_hash = commit.save();
|
||||
head::update_head_commit(&commit_hash);
|
||||
|
||||
{
|
||||
let commit_target = {
|
||||
match current_head {
|
||||
head::Head::Branch(branch_name) => branch_name,
|
||||
head::Head::Detached(commit_hash) => commit_hash[..6].to_string(),
|
||||
}
|
||||
};
|
||||
println!("commit to [{:?}] message{:?}", commit_target, message);
|
||||
println!("commit hash: {:?}", commit_hash);
|
||||
match current_head {
|
||||
head::Head::Branch(branch_name) => {
|
||||
println!("commit to [{:?}] message{:?}", branch_name, message)
|
||||
}
|
||||
head::Head::Detached(commit_hash) => println!(
|
||||
"Detached HEAD commit {:?} message{:?}",
|
||||
commit_hash[0..7].to_string(),
|
||||
message
|
||||
),
|
||||
}
|
||||
|
||||
println!("commit hash: {:?}", commit_hash);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user