Artifact 41e17e0726124a765054581356a6991f5e2b3b857611486ff69039c409aec3a2:
- File
sim/seed.go
— part of check-in
[38efed7a12]
at
2026-08-12 20:50:57
on branch main
— chore(deps): migrate to go-libfossil v0.9.0 (#195)
* chore(deps): migrate to go-libfossil v0.9.0 (renamed module path)
- import path danmestas/libfossil → danmestas/go-libfossil everywhere - CloneOpts.ProjectCode removed upstream; assert via CloneResult instead - Timeline now takes TimelineOpts (cursor pagination, newest-first) - testutil.HasFossil removed; check FossilBinary() != ""
* ci: retrigger checks
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> (user: [email protected], size: 919) [annotate] [blame] [check-ins using]
package sim import ( "fmt" "math/rand" libfossil "github.com/danmestas/go-libfossil" ) // SeedResult records what was seeded into a leaf repo. type SeedResult struct { LeafIndex int UUIDs []string } // SeedLeaf inserts random checkins into a leaf repo so the sync protocol // has content to push. Returns the UUIDs of the created artifacts. func SeedLeaf(r *libfossil.Repo, rng *rand.Rand, count, maxSize int) ([]string, error) { var uuids []string for i := range count { size := rng.Intn(maxSize) + 1 data := make([]byte, size) rng.Read(data) _, uuid, err := r.Commit(libfossil.CommitOpts{ Files: []libfossil.FileToCommit{ {Name: fmt.Sprintf("seed-%d.bin", i), Content: data}, }, Comment: fmt.Sprintf("seed blob %d", i), User: "sim", }) if err != nil { return uuids, fmt.Errorf("seed commit %d: %w", i, err) } uuids = append(uuids, uuid) } return uuids, nil }