Artifact 5591e173c170b12f22dbd24c624a4af5d09882dcc0118cdce9019c72862a6436:
- File
cli/repo_new.go
— part of check-in
[8de2ae751d]
at
2026-10-20 02:58:39
on branch main
— fix(cli): match PATH as fossil does; run pragmas in a fixed order (#457)
* fix(cli): match PATH as fossil does; run pragmas in a fixed order
log --path, cat --at and diff drop a leading ./, a trailing / and doubled or /./ separators, and compare names with the repository's case-sensitive setting, fossil's platform default when unset. Not found stays exit 2, where fossil exits 1; the docs now say so. SettingBoolean moves to internal/repo, shared by sync and checkout.
Opening a repository runs every pragma in a fixed order, not only busy_timeout first.
Tracked in #451
* feat(cli): document and pin repo new for embedding apps
repo new takes the path from -R as the other embedding commands do, refuses a missing parent directory with a message naming it, and is documented in the embedding contract with its output and exit statuses. Tests pin each behaviour and that stock fossil opens the result.
Tracked in #451
* docs(cli): say how ../x, absolute paths and the global case-sensitive setting behave
Tracked in #451 (user: [email protected], size: 768) [annotate] [blame] [check-ins using] [more...]
package cli import ( "fmt" libfossil "github.com/danmestas/go-libfossil" ) // RepoNewCmd creates a new Fossil repository, at Path or else at the -R path. type RepoNewCmd struct { Path string `arg:"" optional:"" help:"Path for new repository file (default: -R)"` User string `help:"Default user name" default:""` } func (c *RepoNewCmd) Run(g *Globals) error { user := c.User if user == "" { user = currentUser() } path := c.Path if path == "" { path = g.Repo } if path == "" { return fmt.Errorf("repo new: no path: give PATH or -R") } r, err := libfossil.Create(path, libfossil.CreateOpts{User: user}) if err != nil { return err } if err := r.Close(); err != nil { return err } fmt.Printf("created repository: %s\n", path) return nil }