Skip to content

Commit ac3fc48

Browse files
authored
fix(core): exclude vm-dev tag from git describe version glob (#843)
`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 <michael.commack@gmail.com>
1 parent 1a57519 commit ac3fc48

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

crates/openshell-core/build.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
6363
///
6464
/// Returns `None` when git is unavailable or the repo has no matching tags.
6565
fn git_version() -> Option<String> {
66+
// Match numeric release tags only (e.g. `v0.0.29`). The bare glob `v*`
67+
// also matches non-release tags like `vm-dev` or `vm-prod`; when one of
68+
// those lands on the same commit as a release tag, `git describe` picks
69+
// it and the resulting version string collapses to `m-dev` after the
70+
// leading `v` is stripped below. Requiring a digit after `v` excludes
71+
// those development tags without losing any release tag.
6672
let output = std::process::Command::new("git")
67-
.args(["describe", "--tags", "--long", "--match", "v*"])
73+
.args(["describe", "--tags", "--long", "--match", "v[0-9]*"])
6874
.output()
6975
.ok()?;
7076

0 commit comments

Comments
 (0)