Factory: read the current version from the remote tags

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Sonnet 5.5 committed 2026-11-17 06:58:14 +01:00
1 parent 18aa63e3e6
commit 0a724142ff
2 files changed
+12 -3

No files matched your search

+2 -1
View File
@@ -9,7 +9,8 @@ until 1.0, minor versions may contain breaking changes.
- **Factory versioning.** Open issues of the forge were never seen (Gitea sends `"pull_request": null`), so every - **Factory versioning.** Open issues of the forge were never seen (Gitea sends `"pull_request": null`), so every
deliverable counted as the last of its milestone and raised the minor version. Now only the last open issue of a deliverable counted as the last of its milestone and raised the minor version. Now only the last open issue of a
milestone raises the minor version; all others raise the patch version. milestone raises the minor version; all others raise the patch version. The current version is read from the
tags on the forge, not from the checkout (which kept tags that were deleted there).
## [v202611-00051] – 2026-11-16 ## [v202611-00051] – 2026-11-16
+10 -2
View File
@@ -80,8 +80,16 @@ pub fn next_version(cur: Ver, b: Bump) -> Ver {
/// Highest `vX.Y.Z` tag of the remote (0.0.0 when there is none). /// Highest `vX.Y.Z` tag of the remote (0.0.0 when there is none).
async fn tags_version(cfg: &RepoCfg, dir: &Path) -> Ver { async fn tags_version(cfg: &RepoCfg, dir: &Path) -> Ver {
let _ = git(cfg, dir, &["fetch", "--tags", "--force", "origin"]).await; // The remote is the truth: a local checkout keeps tags that were deleted on the forge.
git(cfg, dir, &["tag", "-l", "v[0-9]*"]).await.unwrap_or_default().lines().filter_map(parse_version).max().unwrap_or((0, 0, 0)) let remote = git(cfg, dir, &["ls-remote", "--tags", "--refs", "origin", "v[0-9]*"]).await;
let names: Vec<String> = match remote {
Ok(out) => out.lines().filter_map(|l| l.split("refs/tags/").nth(1)).map(str::to_string).collect(),
Err(_) => {
let _ = git(cfg, dir, &["fetch", "--tags", "--force", "origin"]).await;
git(cfg, dir, &["tag", "-l", "v[0-9]*"]).await.unwrap_or_default().lines().map(str::to_string).collect()
}
};
names.iter().filter_map(|t| parse_version(t)).max().unwrap_or((0, 0, 0))
} }
/// `git pull --ff-only` of the default branch in the main checkout, so everything that was merged /// `git pull --ff-only` of the default branch in the main checkout, so everything that was merged