From 94bec44dadeb43cf274e75c8eccc1c2979f6c33c Mon Sep 17 00:00:00 2001 From: Jo <10510431+j178@users.noreply.github.com> Date: Mon, 9 Dec 2024 23:43:27 +0800 Subject: [PATCH] Fix commits_since_last_tag in version info (#9730) ## Summary Before: ```console $ cargo run -- --version uv 0.5.7 (b17902da0 2024-12-09) ``` After: ```console $ cargo run -- --version uv 0.5.7+14 (7cd0ab77a 2024-12-09) ``` Currently `cargo run -- --version` does not includes the number of commits since last tag, because `cargo-dist` create non-annotated tag, and `git log -1 --date=short --abbrev=9 --format='%H %h %cd %(describe)'` use only annoated tags by default. ```console $ git log -1 --date=short --abbrev=9 --format='%H %h %cd %(describe)' 7cd0ab77a91b57f5c101aa0bd46396ede947f330 7cd0ab77a 2024-12-09 ``` To include these tags, use `git log -1 --date=short --abbrev=9 --format='%H %h %cd %(describe:tags)'`, which will display: ```console $ git log -1 --date=short --abbrev=9 --format='%H %h %cd %(describe:tags)' 7cd0ab77a91b57f5c101aa0bd46396ede947f330 7cd0ab77a 2024-12-09 0.5.7-14-g7cd0ab77a ``` --- crates/uv-cli/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/uv-cli/build.rs b/crates/uv-cli/build.rs index 26bcdcf9e..4fba83daa 100644 --- a/crates/uv-cli/build.rs +++ b/crates/uv-cli/build.rs @@ -55,7 +55,7 @@ fn commit_info(workspace_root: &Path) { .arg("-1") .arg("--date=short") .arg("--abbrev=9") - .arg("--format=%H %h %cd %(describe)") + .arg("--format=%H %h %cd %(describe:tags)") .output() { Ok(output) if output.status.success() => output,