Artifact 2f457219ef04cdd293e081128a4cfe447248b823c3c91fbc72bd38effae5f89a:
- File
internal/fsltype/printf_db_test.go
— part of check-in
[087e1c7ce3]
at
2026-10-18 21:49:37
on branch feat/submanifest-reader
— fix(manifest): derive the event rows fossil derives for tags and attachments
A control artifact's 'g' event comment now matches fossil byte for byte: each target introduced by an Edit link, changes sorted by target hash and full tag name, sym- tags named as tags, a branch move linked to its timeline with its own sym- changes left out, values HTML-escaped, no leading space. tag.InsertControlEvent owns the row, and AddTag writes it, as fossil's tag add does; it was missing until a rebuild or clone.
Attachment comments link the attached artifact and the ticket or tech note as fossil 2.28 does, and a deleted attachment's src is NULL. A check-in without a C card gets a NULL event comment. Hash prefixes follow hash-digits up to 64 digits (was capped at 40); the printf helpers move to fsltype so tag, ticket and attachment comments share them.
Fossil-binary oracles: a fossil-made history with tags, branch moves, wiki, tickets, tech notes, forum posts and attachments rebuilt by both, and a go-written history rebuilt by fossil, must give identical event and attachment tables. (user: [email protected], size: 1147) [annotate] [blame] [check-ins using] [more...]
package fsltype_test import ( "path/filepath" "testing" "github.com/danmestas/go-libfossil/db" "github.com/danmestas/go-libfossil/internal/fsltype" _ "github.com/danmestas/go-libfossil/internal/testdriver" ) // TestHashDigits checks the setting is clamped as fossil's hash_digits // clamps it: 6 to HNAME_MAX (64) for display, display+6 floored at 16 and // capped at 64 for links. func TestHashDigits(t *testing.T) { d, err := db.OpenSQL(filepath.Join(t.TempDir(), "c.db"), db.OpenConfig{}, nil) if err != nil { t.Fatal(err) } t.Cleanup(func() { d.Close() }) if _, err := d.Exec("CREATE TABLE config(name TEXT PRIMARY KEY, value)"); err != nil { t.Fatal(err) } cases := []struct { setting any human, url int }{{nil, 10, 16}, {3, 6, 16}, {12, 12, 18}, {50, 50, 56}, {60, 60, 64}, {99, 64, 64}} for _, c := range cases { if _, err := d.Exec("REPLACE INTO config VALUES('hash-digits', ?)", c.setting); err != nil { t.Fatal(err) } if human, url := fsltype.HashDigits(d); human != c.human || url != c.url { t.Errorf("hash-digits %v: got (%d, %d), want (%d, %d)", c.setting, human, url, c.human, c.url) } } }