chore: add git command info

This commit is contained in:
2020-07-25 21:39:35 +08:00
parent 3e17d1f3a5
commit ad732983be

View File

@@ -1,6 +1,7 @@
use std::process::Command; use std::process::Command;
pub fn check_git_status() -> bool { pub fn check_git_status() -> bool {
info!("Run: git fetch --dry-run");
match Command::new("git").env("LANG", "en_US").args(&["fetch", "--dry-run"]).output() { match Command::new("git").env("LANG", "en_US").args(&["fetch", "--dry-run"]).output() {
Err(e) => { Err(e) => {
warn!("Error in run git fetch --dry-run: {}", e); warn!("Error in run git fetch --dry-run: {}", e);
@@ -17,6 +18,7 @@ pub fn check_git_status() -> bool {
}, },
}, },
} }
info!("Run: git status");
match Command::new("git").env("LANG", "en_US").args(&["status"]).output() { match Command::new("git").env("LANG", "en_US").args(&["status"]).output() {
Err(e) => { Err(e) => {
warn!("Error in run git status: {}", e); warn!("Error in run git status: {}", e);
@@ -40,6 +42,7 @@ pub fn check_git_status() -> bool {
} }
pub fn get_git_hash() -> Option<String> { pub fn get_git_hash() -> Option<String> {
info!("Run: git rev-parse HEAD");
match Command::new("git").args(&["rev-parse", "HEAD"]).output(){ match Command::new("git").args(&["rev-parse", "HEAD"]).output(){
Err(e) => { Err(e) => {
warn!("Error in run git rev-parse HEAD: {}", e); warn!("Error in run git rev-parse HEAD: {}", e);