diff --git a/src/cook/fs.rs b/src/cook/fs.rs index b46ec5e0..b32558bf 100644 --- a/src/cook/fs.rs +++ b/src/cook/fs.rs @@ -301,6 +301,7 @@ pub fn get_git_head_rev(dir: &PathBuf) -> Result<(String, bool), String> { } } +/// get commit from "rev" which either a full commit hash or a tag name pub fn get_git_tag_rev(dir: &PathBuf, tag: &str) -> Result { if tag.len() == 40 && tag.chars().all(|f| f.is_ascii_hexdigit()) { return Ok(tag.to_string()); diff --git a/src/cook/ident.rs b/src/cook/ident.rs index 85359956..586e41d1 100644 --- a/src/cook/ident.rs +++ b/src/cook/ident.rs @@ -14,7 +14,7 @@ impl IdentifierConfig { let (commit, _) = crate::cook::fs::get_git_head_rev( &std::env::current_dir().expect("unable to get $PWD"), ) - .expect("Can't read this repository commit"); + .unwrap_or(("".into(), false)); // better than importing heavy deps like chrono let time = String::from_utf8_lossy( &Command::new("date")