Skip to content

get_version.t fails if no tag is available #1418

@jsoref

Description

@jsoref

https://github.com/check-spelling-sandbox/josh-project-josh/actions/runs/14741794393/job/41381279387#step:7:301

proxy/get_version.t: failed
--- tests/proxy/get_version.t
+++ tests/proxy/get_version.t.err
@@ -2,7 +2,7 @@
   $ cd ${TESTTMP}
 
   $ curl -s http://localhost:8002/version
-  Version: *.*.* (glob)
+  Version: 3da0ae7
 
   $ bash ${TESTDIR}/destroy_test_env.sh
   .

The code is testing the /version endpoint...

if path == "/version" {
return Ok(Some(make_response(
hyper::Body::from(version_str()),

fn version_str() -> String {
format!("Version: {}\n", josh::VERSION,)

/// 1. If in a git checkout, and `git` binary is present, use the
/// commit ID or nearest tag.

pub const VERSION: &str = git_version::git_version!(
args = ["--tags", "--always", "--dirty=-modified"],
fallback = match option_env!("JOSH_VERSION") {
Some(v) => v,
None => "unknown",

There are a number of cases where the outcome will not match this pattern...

Certainly, anyone who forks this repository with github's defaults of only cloning the default branch won't have any tags. And if they enable actions and then pull in an updated master, their build would fail. (In my case, I forced the issue by pushing something else to master because I'm testing things, but the same would happen as outlined.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions