Documentation
¶
Overview ¶
Package changes compares the record in the working tree with the record on the configured branch: what `archdoc changes` lists, and what the rules lint runs on a pull request judge. Nothing here prints.
Index ¶
Constants ¶
const ( Arrives = "arrives" Status = "status" Edited = "edited" Removed = "removed" )
The changes a document can have.
Variables ¶
var ErrNoBase = errors.New("no branch to compare against")
ErrNoBase reports that there is no configured branch to compare against, which is a usage error rather than a finding: there is nothing to judge.
Functions ¶
func Differing ¶
func Differing(g git.Repository, rev, revRoot, root string, docPaths []string) (map[string]bool, error)
Differing names which of docPaths, paths within a root, differ between rev, whose documents live under revRoot, and the working tree, whose live under root, as git judges it. A document absent from rev differs.
func NoSharedHistory ¶
NoSharedHistory says HEAD and branch share no commit, formatted with the branch. actions/checkout fetches a depth of one by default, which holds HEAD alone and is the usual way to arrive here.
Types ¶
type Base ¶
type Base struct {
Branch string
// Commit is the merge base of HEAD and Branch, which is what is read.
Commit string
// Root is where the documents live on the base, as a path from the
// repository's top level, which a pull request moving the root changes.
Root string
// Documents is every document on the branch, by path relative to root.
Documents map[string]*repo.Document
// Strict is the branch's own setting, so that a pull request cannot relax
// the rule it is judged by, or the working tree's where the branch holds no
// archdoc.json, as before the first pull request that adds one, or one that
// cannot be read.
Strict bool
}
Base is the record on the configured branch as HEAD last took it in: the commit GitHub merged a pull request against, or the point an unrebased branch was cut from, so that what the branch merged since is not read as removed.
type Change ¶
type Change struct {
Type repo.Type `json:"type"`
ID string `json:"id,omitempty"`
Path string `json:"path"`
Title string `json:"title,omitempty"`
Change string `json:"change"`
From repo.Status `json:"from,omitempty"`
To repo.Status `json:"to,omitempty"`
// Terminal is set on an edit to an RFC or ADR only: whether the document
// was terminal on the base, which L11 reports.
Terminal *bool `json:"terminal,omitempty"`
// contains filtered or unexported fields
}
Change is one document the working tree changes against the base.
type Located ¶
type Located struct {
config.Settings
Root string
// Unreadable is why the revision's archdoc.json could not be read, where
// it could not, and the working tree's settings stand in for it. It is not
// an error: a pull request mending the branch's file could never pass.
Unreadable error
}
Located is the record as a revision holds it: the settings its archdoc.json gives, and its root as a path from the repository's top level.
func Locate ¶
Locate reads the settings rev holds: from its archdoc.json at the working tree's location, or failing that from the one the working tree's moved from, so that a pull request moving the file is still judged by the base's strict and followed to the base's root. Where rev holds neither, as before the pull request that adds ArchDoc, the working tree's own settings stand.