Artifact 1f51a40deaeb9065ebbf77feb9b2be8c90c7cac1732d7e77787d698216285971:
- File
cli/exit.go
— part of check-in
[c11b3055fb]
at
2026-10-22 17:36:26
on branch feat/horizon-cones
— feat(horizon): deepen as a verb, discarding the seed for the old C
Section 5.8 makes deepen the universal remedy of the draft: name a C' that is an ancestor of C and synchronize at it. sync.Deepen finds C' as zit's deepenPoint does, the target itself when it is C's ancestor, else a common ancestor over the P cards the store holds or asked of the origin with the merge-base query; it refuses rather than move C off its own ancestry when none can be established. Repo.DeepenHorizon and 'repo cone deepen' expose it, and the crossing diagnostic now names that command.
Moving a structural horizon through FetchCone now discards the held seed before the transfer, so the request offers none and the seed for C, applied at a later date, cannot shadow propagation from the seed for C'. A transfer that fails puts the old cone and seed back, as zit's deepen does: a store left structural without a seed derives no branch state for K. (user: [email protected], size: 2321) [annotate] [blame] [check-ins using] [more...]
package cli import ( "context" "errors" "fmt" libfossil "github.com/danmestas/go-libfossil" "github.com/danmestas/go-libfossil/internal/content" "github.com/danmestas/go-libfossil/internal/fsltype" ) // Exit statuses the machine-facing commands (snapshot, log, cat --at, diff) // document and keep stable. Every other failure, including a usage error, is // ExitFailure. const ( ExitOK = 0 ExitFailure = 1 ExitNotFound = 2 // the version, path or history asked for does not exist ) // ExitError is a command failure that carries the process exit status it // maps to. The binary's main exits with Code after printing Err. type ExitError struct { Code int Err error } func (e *ExitError) Error() string { return e.Err.Error() } func (e *ExitError) Unwrap() error { return e.Err } // notFound marks err as an ExitNotFound failure. func notFound(err error) error { return &ExitError{Code: ExitNotFound, Err: err} } // resolveVersionExit is resolveRID with a version that does not exist // reported as ExitNotFound. func resolveVersionExit(r *libfossil.Repo, version string) (int64, error) { rid, err := resolveRID(r, version) if errors.Is(err, libfossil.ErrVersionNotFound) { return 0, notFound(err) } if err != nil { return 0, fmt.Errorf("resolving %q: %w", version, err) } return rid, crossesHorizon(r, rid) } // resolveCheckin is resolveRID for an operation that reads the check-in's // tree, which it cannot do across a structural horizon. func resolveCheckin(r *libfossil.Repo, version string) (int64, error) { rid, err := resolveRID(r, version) if err != nil { return 0, err } return rid, crossesHorizon(r, rid) } // crossesHorizon refuses a check-in below the store's structural horizon, // naming the horizon and the remedy (draft-fossil-horizon-00 ยง5.5): its // manifest is not held, and a deepen to it is what brings it. func crossesHorizon(r *libfossil.Repo, rid int64) error { h, below, err := content.BelowHorizon(context.Background(), r.Inner().DB(), fsltype.FslID(rid)) if err != nil || !below { return err } uuid, err := r.UUIDFromRID(rid) if err != nil { return err } return fmt.Errorf("%s is below the structural horizon at %s: its history is not held here; "+ "deepen the horizon to it (repo cone deepen %s) to reach it", uuid, h.Hash(), uuid) }