From 27da5baa8d40fb21d0cb0a7724e89d8f02ae9c40 Mon Sep 17 00:00:00 2001 From: Lann Martin Date: Sat, 22 Aug 2026 22:41:43 -0400 Subject: [PATCH] version-guard: fetch the last-cut tag with a destination refspec The v0.5.0 cut's first dispatch failed (closed, as designed) in cut-conventions-goldens: 'git fetch origin refs/tags/v0.4.0' drops the objects into FETCH_HEAD but creates no local ref, so the tag NAME stays unresolvable in the release job's shallow checkout and the goldens diff dies with 'bad revision'. The PR-base fetch this mirrored gets away with a bare source because a raw sha resolves from the object store alone; a tag name needs a ref. Fetch +refs/tags/X:refs/tags/X instead; verified against a real shallow tag-less clone (mock argv keys are re-pinned, but they are what missed this). --- tools/version-guard/check.ts | 13 ++++++++++++- tools/version-guard/check_test.ts | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/tools/version-guard/check.ts b/tools/version-guard/check.ts index bf5bdf0..a6a84c3 100644 --- a/tools/version-guard/check.ts +++ b/tools/version-guard/check.ts @@ -698,7 +698,18 @@ export async function cutGoldenChanges( lastTag: string, sha: string, ): Promise { - await fx.run("git", ["fetch", "origin", `refs/tags/${lastTag}`, "--depth=1"]); + // The full-refspec form is load-bearing: without a DESTINATION + // (`:refs/tags/…`) the fetch drops the objects into FETCH_HEAD but + // creates no local ref, so the tag NAME stays unresolvable and the diff + // below fails with "bad revision" (the v0.5.0 cut, first dispatch). The + // PR-base fetch this mirrors gets away with a bare source because a raw + // sha resolves from the object store alone; a tag name needs a ref. + await fx.run("git", [ + "fetch", + "origin", + `+refs/tags/${lastTag}:refs/tags/${lastTag}`, + "--depth=1", + ]); let diff = await fx.run("git", [ "diff", "--name-status", diff --git a/tools/version-guard/check_test.ts b/tools/version-guard/check_test.ts index c5af6c2..6587f37 100644 --- a/tools/version-guard/check_test.ts +++ b/tools/version-guard/check_test.ts @@ -625,7 +625,7 @@ Deno.test("cut: end to end — window scan, guards, and the notes fragment", asy }), }, git: { - "fetch origin refs/tags/v0.4.0 --depth=1": {}, + "fetch origin +refs/tags/v0.4.0:refs/tags/v0.4.0 --depth=1": {}, "diff --name-status v0.4.0..cut12345 -- runtime/tests/conventions/golden/": { stdout: "" }, }, @@ -797,7 +797,7 @@ function cutFake(over: { }), }, git: { - "fetch origin refs/tags/v0.4.0 --depth=1": {}, + "fetch origin +refs/tags/v0.4.0:refs/tags/v0.4.0 --depth=1": {}, "diff --name-status v0.4.0..cut12345 -- runtime/tests/conventions/golden/": { stdout: over.goldenDiff ?? "" }, },