checkpoint: add DefaultV1Refs constructor · Entire
checkpoint: add DefaultV1Refs constructor
caa8d6f→main·
pfleidi·1mo ago·2 files·+22 added/-6 removed
DefaultV1Refs names the v1-only topology. The resolver uses it as the base for both branches; opted-in mode overrides Read and Mirror to the v1.1 custom ref.
Sessions
8b8e174c5c41View transcript
[?
Streamline Checkpoint Version Mirroring with refs.PrimaryClaude Code·1 step](/content/gh/entireio/cli/session/7d8b9a47-6f94-441b-adae-5402ded54425#timeline-8b8e174c5c41/index.html)
Changes
2
cmd/entire/cli/checkpoint
Mcommitted_refs.go+12/-6
Mcommitted_refs_test.go+10
22 unmodified lines
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
15 unmodified lines
55
56
57
47
48
49
50
51
52
58
59
60
61
22 unmodified lines
// HasMirror reports whether a mirror ref is configured.
func (r CommittedRefs) HasMirror() bool { return r.Mirror != "" }
// DefaultV1Refs returns the v1-only topology used by callers that have no
// resolver context (typically tests and the resolver's default branch).
func DefaultV1Refs() CommittedRefs {
v1Branch := plumbing.NewBranchReferenceName(paths.MetadataBranchName)
return CommittedRefs{
Primary: v1Branch,
Read: v1Branch,
Push: []plumbing.ReferenceName{v1Branch},
}
}
// PrimaryFetchableFromOrigin reports whether Primary has an origin-tracking
// shadow — i.e. whether bootstrap-from-origin paths can fetch it. True when
// Primary appears in Push: we push it, so origin tracks it.
15 unmodified lines
}
func committedRefsFor(mirrorEnabled bool) CommittedRefs {
v1Branch := plumbing.NewBranchReferenceName(paths.MetadataBranchName)
refs := CommittedRefs{
Primary: v1Branch,
Read: v1Branch,
Push: []plumbing.ReferenceName{v1Branch},
}
refs := DefaultV1Refs()
if mirrorEnabled {
custom := plumbing.ReferenceName(paths.MetadataRefName)
refs.Read = custom
Mcmd/entire/cli/checkpoint/committed_refs.go+12/-6
57 unmodified lines
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
57 unmodified lines
}
}
func TestDefaultV1Refs(t *testing.T) {
t.Parallel()
v1 := v1BranchRef()
assert.Equal(t, CommittedRefs{
Primary: v1,
Read: v1,
Push: []plumbing.ReferenceName{v1},
}, DefaultV1Refs())
}
func TestCommittedRefs_PrimaryFetchableFromOrigin(t *testing.T) {
t.Parallel()
v1, custom := v1BranchRef(), customRef()