diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-12-04 01:03:00 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-12-04 01:03:00 +0900 |
| commit | b58c775f9006459c751dc93d880aeff41dbff25d (patch) | |
| tree | 58771efeb85b2c4a44bbc3b706a592c4ee24769e | |
| parent | b0110977521410749ae02fb8cbec9220be7e7894 (diff) | |
internal/rosa: set revision directly
This skips the otherwise unconditional prefix.
Signed-off-by: Ophestra <cat@gensokyo.uk>
| -rw-r--r-- | internal/rosa/state.go | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/internal/rosa/state.go b/internal/rosa/state.go index 04d98184..2666e646 100644 --- a/internal/rosa/state.go +++ b/internal/rosa/state.go @@ -543,9 +543,10 @@ func (s *S) Collect() (handles P) { // deferredGit is a call to [Toolchain.NewViaGit] from azalea. type deferredGit struct { - url string - tag string + url, rev string checksum pkg.Checksum + + tag string } // getFrame must be called before accessing s. @@ -828,6 +829,7 @@ func (s *S) getFrame() azalea.Frame { var checksum string if err = args.Apply(map[unique.Handle[azalea.Ident]]any{ k("url"): &a.url, + k("rev"): &a.rev, k("tag"): &a.tag, k("checksum"): &checksum, }); err != nil { @@ -1122,6 +1124,9 @@ func (e HelperError) Error() string { return "package " + strconv.Quote(string(e)) + " has no exec helper" } +// ErrDeferredGit is panicked if both rev and tag arguments are set. +var ErrDeferredGit = errors.New("rev and tag are both set") + // evalArtifact resolves deferred toolchain information. func (t Toolchain) evalArtifact(v any, meta *Metadata) pkg.Artifact { switch p := v.(type) { @@ -1129,7 +1134,15 @@ func (t Toolchain) evalArtifact(v any, meta *Metadata) pkg.Artifact { return p case deferredGit: - return t.NewViaGit(p.url, "refs/tags/"+p.tag, p.checksum) + rev := p.rev + if p.tag != "" { + if rev != "" { + panic(ErrDeferredGit) + } + rev = "refs/tags/" + p.tag + } + + return t.NewViaGit(p.url, rev, p.checksum) case azalea.Ident: _meta, source := t.Load(H(string(p))) |
