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 ?? "" }, },