From 01c26df6b0c3d746e98f0ac4a611e80ffdaf03f7 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 23 Oct 2023 13:40:03 -0400 Subject: [PATCH] xtask: Fix srpm generation Fixing the tagged generation broke the untagged case. Signed-off-by: Colin Walters --- xtask/src/xtask.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xtask/src/xtask.rs b/xtask/src/xtask.rs index 43e6b407b..09b5f73d9 100644 --- a/xtask/src/xtask.rs +++ b/xtask/src/xtask.rs @@ -64,11 +64,15 @@ fn gitrev(sh: &Shell) -> Result { { Ok(gitrev_to_version(&rev)) } else { - let mut desc = cmd!(sh, "git describe --tags --always").read()?; - desc.insert_str(0, "0."); + // Grab the abbreviated commit + let abbrev_commit = cmd!(sh, "git rev-parse HEAD") + .read()? + .chars() + .take(10) + .collect::(); let timestamp = git_timestamp(sh)?; // We always inject the timestamp first to ensure that newer is better. - Ok(format!("{timestamp}.{desc}")) + Ok(format!("{timestamp}.g{abbrev_commit}")) } }