Allow commit not found

This commit is contained in:
Wildan M 2025-12-14 23:45:29 +07:00
parent cc593c6c58
commit fec4236903
No known key found for this signature in database
GPG Key ID: 01AC53185C679C79
2 changed files with 2 additions and 1 deletions

View File

@ -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<String, String> {
if tag.len() == 40 && tag.chars().all(|f| f.is_ascii_hexdigit()) {
return Ok(tag.to_string());

View File

@ -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")