Artifact 96ba38d64dc6075f02d66c44d11767d95c5a617d382e6df6212011a267ceaa5f:
- File
conformance/repostate_date_test.go
— part of check-in
[81b0b585e5]
at
2026-10-12 19:16:10
on branch main
— fix(manifest): set event.mtime from the newest date tag (#334) (#344)
fossil's check-in time override (`fossil amend --date`) is a one-shot date tag. manifest_crosslink takes a check-in's event.mtime from that tag's value when tagxref already holds one, and tag_insert moves event.mtime (keeping the original in omtime) whenever a date tag wins its tagxref row. Crosslink always used the D-card time, so every date-amended check-in sat at its original time.
Crosslinking a check-in now reads its date tag back, and tag.ApplyTagWithTx applies the override. tag.ApplyTag and tag.AddTag now derive through ApplyTagWithTx rather than repeating it, so a tag added directly moves event.mtime and event.bgcolor as crosslink would.
New fossil-referenced repository-state cases cover the tag after the check-in, before it (on a phantom), and newest-wins. (user: [email protected], size: 2107) [annotate] [blame] [check-ins using]
package conformance import "testing" // The date tag is fossil(1)'s check-in time override (`fossil amend // --date`): its value, not the manifest's D card, sets the check-in's // event.mtime, and the newest date tag wins. That contradicts // draft-fossil-repo-state-00, whose Section 1 has the manifest date carry // the check-in mtime and orders by the event.mtime derived from it; // draft-fossil-repo-state-01 adds the override (Section 4.2, step 6, "Event // time"). Until the suite is re-pinned to the -01 drafts these cases name no // requirement and stay out of the coverage audit, with fossil(1) as their // reference; they get their requirement ID with that re-pin. // dateCase compares the event rows of c1 and c2, whose second check-in a // date tag may move, with the control artifacts' own rows. func dateCase(id string, arts []rsArt, want []string, ignoring ...string) rsCase { return rsCase{ Case: Case{ID: id}, arts: arts, tables: []string{"event"}, want: rows("event", want...), ignoring: ignoring, rebuild: true, } } func dateTagCases() []rsCase { twoCheckins := chain()[:2] tagFirst := []rsArt{chain()[0], control("t", 9, "+date {c2} "+rsTime(30)), chain()[1]} tagFirstCase := dateCase("repostate.fossil.date-tag-before-checkin", tagFirst, []string{"c1 ci @1", "c2 ci @30", "t g @9"}, "-event: c2 ci @30", "+event: c2 ci @2") tagFirstCase.each = true return []rsCase{ dateCase("repostate.fossil.date-tag-sets-mtime", with(twoCheckins, control("t", 9, "+date {c2} "+rsTime(30))), []string{"c1 ci @1", "c2 ci @30", "t g @9"}, "-event: c2 ci @30", "+event: c2 ci @2"), tagFirstCase, dateCase("repostate.fossil.date-tag-newest-wins", with(twoCheckins, control("t1", 9, "+date {c2} "+rsTime(40)), control("t2", 8, "+date {c2} "+rsTime(30))), []string{"c1 ci @1", "c2 ci @40", "t1 g @9", "t2 g @8"}, "-event: c2 ci @40", "+event: c2 ci @30"), } } func TestRepoStateDateTag(t *testing.T) { runRepoStateCases(t, dateTagCases()) } func TestRepoStateDateTagReasons(t *testing.T) { checkRepoStateReasons(t, dateTagCases()) }