I5: a release re-pins only modules on the version line
repinned names no module whose import form is set: its fingerprint takes no pin, so a release of a package it imports never moves it; a module on the version line is named as before. Builds: design 47 H2 H-A-530, H-A-538
This commit is contained in:
@@ -77,6 +77,20 @@ func TestAReleaseRepinsAnEntryNamingItsPackageWithNoPin(t *testing.T) {
|
||||
if _, err := ix.HearVersion(ctx, HeardVersion{Package: "mesh-sdk/go", GoModule: "git.novox.be/novox/mesh-sdk/go", Version: "0.1.27", Published: true}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// I5/AC1 (design 47 H2 H-A-530): a module on the import form (its import form set, H-A-538) is named by no re-pin;
|
||||
// I5/AC2: on the version line, as g is, it is.
|
||||
onImports := g
|
||||
in := *g.Inputs2
|
||||
in.Imports, in.ImportForm = []string{"git.novox.be/novox/mesh-sdk/go"}, "src2:"+strings.Repeat("a", 64)
|
||||
onImports.Inputs2 = &in
|
||||
mods.put("g", mustEncode(t, onImports))
|
||||
if only, err := ix.repinned(ctx, "mesh-sdk"); err != nil || only["g"] {
|
||||
t.Errorf("a re-pin of mesh-sdk names %v (%v), want no module on the import form", only, err)
|
||||
}
|
||||
mods.put("g", mustEncode(t, g))
|
||||
if only, err := ix.repinned(ctx, "mesh-sdk"); err != nil || !only["g"] {
|
||||
t.Errorf("a re-pin of mesh-sdk names %v (%v), want g, on the version line", only, err)
|
||||
}
|
||||
if n, err := ix.Repin(ctx, "mesh-sdk", "0.1.27"); err != nil || n != 2 {
|
||||
t.Errorf("a release of mesh-sdk re-pinned %d modules (%v), want g on each of the two branches, which requires it with no pin", n, err)
|
||||
}
|
||||
|
||||
@@ -702,7 +702,9 @@ func (ix *Indexer) repinModules(ctx context.Context, branch string, modules []st
|
||||
}
|
||||
|
||||
// repinned are the modules the indexer's modules state holds whose packages name a package of module: by their pins, and
|
||||
// by their kept requirements, which name a package they hold no pin of yet (design 47 H-A-204, H-A-165, H-A-167).
|
||||
// by their kept requirements, which name a package they hold no pin of yet (design 47 H-A-204, H-A-165, H-A-167). Only a
|
||||
// module on the version line is named: one on the import form (its import form set, H2 H-A-538) takes no pin into its
|
||||
// fingerprint, so a release never moves it (H-A-530).
|
||||
func (ix *Indexer) repinned(ctx context.Context, module string) (map[string]bool, error) {
|
||||
held, err := ix.heldModules(ctx)
|
||||
if err != nil {
|
||||
@@ -710,6 +712,9 @@ func (ix *Indexer) repinned(ctx context.Context, module string) (map[string]bool
|
||||
}
|
||||
only := map[string]bool{}
|
||||
for key, m := range held {
|
||||
if m.Inputs2 != nil && m.Inputs2.ImportForm != "" {
|
||||
continue
|
||||
}
|
||||
names := slices.Collect(maps.Keys(m.Packages))
|
||||
if m.Inputs2 != nil {
|
||||
names = append(names, m.Inputs2.Packages...)
|
||||
|
||||
Reference in New Issue
Block a user