From 7bf991211986ee17094f9ed7e39ae24722ceee80 Mon Sep 17 00:00:00 2001 From: mjamiv Date: Wed, 15 Apr 2026 05:32:43 +0000 Subject: [PATCH] fix(core): exclude vm-dev tag from git describe version glob MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `git describe --tags --long --match "v*"` matches the `vm-dev` tag alongside release tags. When `vm-dev` sits on or past the latest release tag in the commit graph (currently the case on main), git picks it, and the resulting `vm-dev-N-gSHA` string strips the leading `v` down to `m-dev-N-gSHA`. With `commits == 0` that's returned verbatim, producing a binary that reports itself as `m-dev`: $ openshell --version openshell m-dev Confirmed on v0.0.28 (#832) and reproduced on v0.0.29 as well. Restrict the glob to numeric release tags (`v[0-9]*`). All release tags follow `v\d+\.\d+\.\d+`, so this loses no valid version — it only filters out `vm-dev`, `vm-prod`, and any similar non-release tags that share the `v` prefix. Verified locally on this repo's current HEAD: # before $ git describe --tags --long --match 'v*' vm-dev-0-g355d845 # after $ git describe --tags --long --match 'v[0-9]*' v0.0.29-2-g355d845 Closes #832 Signed-off-by: mjamiv --- crates/openshell-core/build.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/openshell-core/build.rs b/crates/openshell-core/build.rs index c89a03483..e57de4465 100644 --- a/crates/openshell-core/build.rs +++ b/crates/openshell-core/build.rs @@ -63,8 +63,14 @@ fn main() -> Result<(), Box> { /// /// Returns `None` when git is unavailable or the repo has no matching tags. fn git_version() -> Option { + // Match numeric release tags only (e.g. `v0.0.29`). The bare glob `v*` + // also matches non-release tags like `vm-dev` or `vm-prod`; when one of + // those lands on the same commit as a release tag, `git describe` picks + // it and the resulting version string collapses to `m-dev` after the + // leading `v` is stripped below. Requiring a digit after `v` excludes + // those development tags without losing any release tag. let output = std::process::Command::new("git") - .args(["describe", "--tags", "--long", "--match", "v*"]) + .args(["describe", "--tags", "--long", "--match", "v[0-9]*"]) .output() .ok()?;