Artifact 5c886e9f2c2bcf3fba43fb5bfb59dcb2b54bf784f760578b2fc5536519d9ccaa:
- File
repo_extras.go
— part of check-in
[6273a0750d]
at
2026-07-22 23:03:24
on branch trunk
— fix: correct go.mod module path to go-libfossil (#76) (#117)
* fix: correct go.mod module path to go-libfossil (#76)
The module directive still declared github.com/danmestas/libfossil after the repository was renamed to go-libfossil. pkg.go.dev/godoc scraping matches the declared module path against its hosting path, so the stale path broke SDK doc generation.
Rename the module path across all four in-repo modules (root, the two db/driver submodules, observer/otel, and docs/site) and every internal import, plus the release workflow, the doc-generation script, and the docs.
No tag has been published under the go-libfossil path yet, so the cross-module requires cannot resolve from the proxy. Add replace directives pointing the in-repo requires at their local directories so GOWORK=off builds and the CI matrix resolve without a published version. These replaces are ignored by downstream consumers and can be dropped once new-path tags are cut.
* Guard releases against replace directives; regenerate SDK docs
The go-libfossil rename bridges the in-repo modules with `replace` directives. Go refuses a main module that carries them, so a tag cut while they are present breaks `go install .../cmd/libfossil@<tag>` and every `@version` fetch of the driver submodules. Add a Release workflow step that fails the job before anything is published if any tracked go.mod still contains a replace directive, so the bridge is a CI-enforced TODO rather than a silent landmine. The step comment records what unblocks a release: re-tag the submodules with the corrected module paths, bump the root requires, then drop the replace blocks.
Regenerate the SDK reference docs. The previous pass only substituted URLs over the pre-existing generated files, leaving stale signatures (Repo.Timeline was still documented as taking LogOpts rather than TimelineOpts). Note that gomarkdoc must be run outside a git worktree — inside one it silently strips every source link.
Also reword the README rename note, which read as though the import path had not changed, and re-sort the ncruces require block. (user: [email protected], size: 4255) [annotate] [blame] [check-ins using]
package libfossil import ( "fmt" "time" "github.com/danmestas/go-libfossil/internal/fsltype" "github.com/danmestas/go-libfossil/internal/tag" "github.com/danmestas/go-libfossil/internal/uv" ) // StashEntry describes a saved stash. type StashEntry struct { ID int64 Comment string Time string } // TagOpts configures a tag operation. type TagOpts struct { Name string TargetID int64 Value string User string Time time.Time } // UVEntry describes an unversioned file. type UVEntry struct { Name string Size int64 Mtime time.Time Hash string } // Tag creates a control artifact that adds a tag to a target checkin. // Returns the UUID of the tag control artifact. func (r *Repo) Tag(opts TagOpts) (int64, error) { rid, err := tag.AddTag(r.inner, tag.TagOpts{ TargetRID: fsltype.FslID(opts.TargetID), TagName: opts.Name, TagType: tag.TagSingleton, Value: opts.Value, User: opts.User, Time: opts.Time, }) if err != nil { return 0, fmt.Errorf("libfossil: tag: %w", err) } return int64(rid), nil } // StashSave saves working-tree changes to the stash. // Requires a checkout database; not yet wired (Repo only wraps the repo DB). func (r *Repo) StashSave(dir, comment string) error { return fmt.Errorf("libfossil: stash save: not yet implemented (requires checkout DB)") } // StashPop restores the most recent stash entry and removes it. func (r *Repo) StashPop(dir string) error { return fmt.Errorf("libfossil: stash pop: not yet implemented (requires checkout DB)") } // StashApply restores a stash entry by ID without removing it. func (r *Repo) StashApply(dir string, id int64) error { return fmt.Errorf("libfossil: stash apply: not yet implemented (requires checkout DB)") } // StashList returns all stash entries. func (r *Repo) StashList() ([]StashEntry, error) { return nil, fmt.Errorf("libfossil: stash list: not yet implemented (requires checkout DB)") } // StashDrop removes a stash entry by ID. func (r *Repo) StashDrop(id int64) error { return fmt.Errorf("libfossil: stash drop: not yet implemented (requires checkout DB)") } // StashClear removes all stash entries. func (r *Repo) StashClear() error { return fmt.Errorf("libfossil: stash clear: not yet implemented (requires checkout DB)") } // Undo reverts the last commit or merge. // Requires a checkout database; not yet wired. func (r *Repo) Undo(dir string) error { return fmt.Errorf("libfossil: undo: not yet implemented (requires checkout DB)") } // Redo re-applies the last undone operation. // Requires a checkout database; not yet wired. func (r *Repo) Redo(dir string) error { return fmt.Errorf("libfossil: redo: not yet implemented (requires checkout DB)") } // UVWrite writes an unversioned file to the repository. func (r *Repo) UVWrite(name string, content []byte, mtime time.Time) error { if err := uv.EnsureSchema(r.inner.DB()); err != nil { return fmt.Errorf("libfossil: uv write: %w", err) } mtimeUnix := mtime.Unix() if mtime.IsZero() { mtimeUnix = time.Now().Unix() } return uv.Write(r.inner.DB(), name, content, mtimeUnix) } // UVDelete marks an unversioned file as deleted (tombstone). func (r *Repo) UVDelete(name string, mtime time.Time) error { if err := uv.EnsureSchema(r.inner.DB()); err != nil { return fmt.Errorf("libfossil: uv delete: %w", err) } mtimeUnix := mtime.Unix() if mtime.IsZero() { mtimeUnix = time.Now().Unix() } return uv.Delete(r.inner.DB(), name, mtimeUnix) } // UVRead reads an unversioned file from the repository. // Returns the content, mtime (unix seconds), and content hash. func (r *Repo) UVRead(name string) ([]byte, int64, string, error) { return uv.Read(r.inner.DB(), name) } // UVList returns all unversioned file entries. func (r *Repo) UVList() ([]UVEntry, error) { if err := uv.EnsureSchema(r.inner.DB()); err != nil { return nil, fmt.Errorf("libfossil: uv list: %w", err) } entries, err := uv.List(r.inner.DB()) if err != nil { return nil, fmt.Errorf("libfossil: uv list: %w", err) } result := make([]UVEntry, len(entries)) for i, e := range entries { result[i] = UVEntry{ Name: e.Name, Size: int64(e.Size), Mtime: time.Unix(e.MTime, 0), Hash: e.Hash, } } return result, nil }