Documentation
¶
Overview ¶
Package gitx runs the few git commands loupe needs against the user's clone.
Index ¶
- func BatchCheckSizes(clone string, oids []string) (map[string]int64, error)
- func Blob(clone, ref, path string) ([]byte, error)
- func BranchUpstream(clone, branch string) (remote, merge string, err error)
- func CommonDir(dir string) (string, error)
- func ConfigBool(clone, key string) (bool, error)
- func CurrentBranch(clone string) (string, error)
- func Diff(clone, baseRef, headRef string) ([]byte, error)
- func DiffLiteral(clone, base, tree string, paths []string) ([]byte, error)
- func FetchPR(clone string, number int, baseSHA, baseRef, headRef string) error
- func LsTreeNames(clone, treeish string) ([]string, error)
- func MergeBase(clone, baseRef, headRef string) (string, error)
- func OriginMatches(clone, owner, repo string) error
- func OriginURLs(clone string) ([]string, error)
- func ParseGitHubURL(s string) (owner, repo string, ok bool)
- func RemoteURLs(clone, remote string) ([]string, error)
- func RevParse(clone, ref string) (string, error)
- func Toplevel(dir string) (string, error)
- type ConvertedError
- type Index
- type Numstat
- type RawEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BatchCheckSizes ¶
BatchCheckSizes returns the size of each object, keyed as given. A missing object is an error.
func Blob ¶
Blob returns path's bytes at ref. cat-file applies no textconv or filter, as Diff applies none.
func BranchUpstream ¶
BranchUpstream returns branch.<branch>.remote and branch.<branch>.merge, each empty when unset.
func CommonDir ¶
CommonDir returns the repository directory that every worktree of dir shares. Git prints it relative to dir, and --path-format=absolute needs Git 2.31.
func ConfigBool ¶
ConfigBool reads key as Git reads a bool, so yes, on and 1 are true. An unset key is false.
func CurrentBranch ¶
CurrentBranch treats any fatal git failure, such as clone not being a repository, as no run being selectable rather than a defect, because the branch is only consulted when nothing else named a run.
func Diff ¶
Diff compares the head against its merge base with the base, as GitHub's pull request diff does, so lines the base gained after the branch point are not offered for comments.
func DiffLiteral ¶
DiffLiteral is Diff's pinned output over exactly paths. git diff has no --pathspec-from-file, so the paths go as :(literal) arguments, which no path can turn into a glob. Sections for different files are independent, so the joined calls parse as one diff.
func FetchPR ¶
FetchPR fetches from origin by name, never from a URL built from the pull request, and disables hooks, maintenance, submodules, tags, pruning and FETCH_HEAD so the pull request head cannot run anything or touch other refs.
func LsTreeNames ¶
LsTreeNames lists every path in treeish. --full-tree lists from the root even when clone is a subdirectory.
func OriginMatches ¶
OriginMatches accepts the configured origin URL or its insteadOf expansion: a clone whose github.com URL is rewritten to a mirror is still that repository, and insteadOf is the user's own config, not pull request input.
func OriginURLs ¶
OriginURLs returns the configured origin URL and its insteadOf expansion, or nothing when there is no origin.
func ParseGitHubURL ¶
ParseGitHubURL accepts https://github.com/o/r, git@github.com:o/r and ssh://git@github.com/o/r, each with an optional .git suffix.
func RemoteURLs ¶
RemoteURLs returns the configured URL of remote and its insteadOf expansion, or nothing when it has no URL.
Types ¶
type ConvertedError ¶
type ConvertedError struct {
Paths []string
}
ConvertedError is StageWorktree's refusal to stage tracked files whose bytes on disk differ from HEAD's while Git converts them on checkout. Without running the conversion, which capture never does, an edit and the conversion look the same.
func (*ConvertedError) Error ¶
func (e *ConvertedError) Error() string
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index runs git against a temporary index file, so the user's .git/index is never written or locked. Only the stat check for untouched filtered files reads it.
func (*Index) StageWorktree ¶
StageWorktree stages the working tree as git add -A would, with each file's bytes exactly as they are on disk. It hashes with --no-filters, so no clean or process filter from the user's config runs and no line ending changes: a filter is a command, and capture runs none. It expects the index to hold HEAD, from ReadTree. A tracked file whose bytes differ from HEAD's while Git converts it on checkout refuses with a *ConvertedError.