Artifact 24bf9ba121c4a285a2992a39ffc0a0b4d0a94194531bc65968b9ca7336024dea:
- File
internal/repo/mainbranch.go
— part of check-in
[245a0ed306]
at
2026-10-20 02:08:49
on branch feat/submanifest-reader
— conformance: re-pin the three drafts to their -00 names
zit check-in 68a3f76cb7 renames the artifact-format, repo-state and sync-protocol drafts from -01 to -00 in their headers, cross-references and reference entries, and retitles each Changes appendix "Changes in This Revision". No normative text changed and no section number moved.
The pinned copies take zit's file names, the requirement tables pin the new hashes, and the comments, tests and docs that cited the -01 drafts cite the -00 ones. The refresh script copies every draft under its own name. The sparse-cone copy is re-pinned to d497c2432f, whose text is unchanged. Coverage counts are identical before and after. (user: [email protected], size: 1113) [annotate] [blame] [check-ins using] [more...]
package repo import ( "database/sql" "errors" "fmt" "github.com/danmestas/go-libfossil/db" ) // DefaultMainBranch is the default branch of a repository whose main-branch // setting is unset. const DefaultMainBranch = "trunk" // MainBranch is the repository's default branch: the main-branch setting, or // DefaultMainBranch when that is unset. draft-fossil-repo-state-00 Section 6.1 // attributes a check-in with no active branch tag to this branch and forbids // assuming "trunk" when the setting is present. An empty value is read as // unset (no branch has an empty name), which departs from the draft and from // fossil's db_get, which would return the empty string. func MainBranch(q db.Querier) (string, error) { if q == nil { panic("repo.MainBranch: q must not be nil") } var value sql.NullString err := q.QueryRow("SELECT value FROM config WHERE name = 'main-branch'").Scan(&value) if errors.Is(err, sql.ErrNoRows) || (err == nil && value.String == "") { return DefaultMainBranch, nil } if err != nil { return "", fmt.Errorf("repo.MainBranch: %w", err) } return value.String, nil }