{"modulePath":"github.com/github/git-sizer","version":"v1.6.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package git\n\n## Constants\n\n```go\nconst (\n\tHashSizeSHA256 = sha256.Size\n\tHashSizeSHA1   = sha1.Size\n\tHashSizeMax    = HashSizeSHA256\n)\n```\n\n## Variables\n\n```go\nvar AllReferencesFilter allReferencesFilter\n```\n\n```go\nvar Exclude exclude\n```\n\n```go\nvar Include include\n```\n\n```go\nvar NoReferencesFilter noReferencesFilter\n```\n\n## Functions\n\n```go\nfunc IsNullOID(o OID) bool\n```\n\n## Types\n\n```go\ntype BatchHeader struct {\n\tOID        OID\n\tObjectType ObjectType\n\tObjectSize counts.Count32\n}\n```\n\n```go\nfunc ParseBatchHeader(spec string, header string) (BatchHeader, error)\n```\nParse a \\`cat-file --batch\\[-check]\\` output header line (including the trailing LF). \\`spec\\`, if not \"\", is used in error messages.\n\n```go\ntype BatchObjectIter struct {\n\t// contains filtered or unexported fields\n}\n```\nBatchObjectIter iterates over objects whose names are fed into its stdin. The output is buffered, so it has to be closed before you can be sure that you have gotten all of the objects.\n\n```go\nfunc (iter *BatchObjectIter) Close()\n```\nClose closes the iterator and frees up resources. Close must be called exactly once.\n\n```go\nfunc (iter *BatchObjectIter) Next() (ObjectRecord, bool, error)\n```\nNext either returns the next object (its header and contents), or a \\`false\\` boolean value if no more objects are left. Objects need to be read asynchronously, but the last objects won't necessarily show up here until \\`Close()\\` has been called.\n\n```go\nfunc (iter *BatchObjectIter) RequestObject(oid OID) error\n```\nRequestObject requests that the object with the specified \\`oid\\` be processed. The objects registered via this method can be read using \\`Next()\\` in the order that they were requested.\n\n```go\ntype Combiner interface {\n\tCombine(f1, f2 ReferenceFilter) ReferenceFilter\n\tInverted() Combiner\n}\n```\nCombiner combines two \\`ReferenceFilter\\`s into one compound one. \\`f1\\` is allowed to be \\`nil\\`.\n\n```go\ntype Commit struct {\n\tSize    counts.Count32\n\tParents []OID\n\tTree    OID\n}\n```\nCommit represents the parts of a commit object that we need.\n\n```go\nfunc ParseCommit(oid OID, data []byte) (*Commit, error)\n```\nParseCommit parses the commit object whose contents are in \\`data\\`. \\`oid\\` is used only in error messages.\n\n```go\ntype Config struct {\n\t// Prefix is the key prefix that was read to fill this `Config`.\n\tPrefix string\n\n\t// Entries contains the configuration entries that matched\n\t// `Prefix`, in the order that they are reported by `git config\n\t// --list`.\n\tEntries []ConfigEntry\n}\n```\nConfig represents the gitconfig, or part of the gitconfig, read by \\`ReadConfig()\\`.\n\n```go\nfunc (config *Config) FullKey(key string) string\n```\nFullKey returns the full gitconfig key name for the relative key name \\`key\\`.\n\n```go\ntype ConfigEntry struct {\n\t// Key is the entry's key, with any common `prefix` removed (see\n\t// `Config()`).\n\tKey string\n\n\t// Value is the entry's value, as a string.\n\tValue string\n}\n```\nConfigEntry represents an entry in the gitconfig.\n\n```go\ntype HashAlgo int\n```\n\n```go\nconst (\n\tHashUnknown HashAlgo = iota\n\tHashSHA1\n\tHashSHA256\n)\n```\n\n```go\nfunc (h HashAlgo) HashSize() int\n```\n\n```go\nfunc (h HashAlgo) NullOID() OID\n```\n\n```go\ntype OID struct {\n\t// contains filtered or unexported fields\n}\n```\nOID represents the SHA-1 object ID of a Git object, in binary format.\n\n```go\nfunc NewOID(s string) (OID, error)\n```\nNewOID converts an object ID in hex format (i.e., \\`\\[0-9a-f]{40,64}\\`) into an \\`OID\\`.\n\n```go\nfunc OIDFromBytes(oidBytes []byte) (OID, error)\n```\nOIDFromBytes converts a byte slice containing an object ID in binary format into an \\`OID\\`.\n\n```go\nfunc (oid OID) Bytes() []byte\n```\nBytes returns a byte slice view of \\`oid\\`, in binary format.\n\n```go\nfunc (oid OID) MarshalJSON() ([]byte, error)\n```\nMarshalJSON expresses \\`oid\\` as a JSON string with its enclosing quotation marks.\n\n```go\nfunc (oid OID) String() string\n```\nString formats \\`oid\\` as a string in hex format.\n\n```go\ntype ObjectHeaderIter struct {\n\t// contains filtered or unexported fields\n}\n```\nObjectHeaderIter iterates over the headers within a commit or tag object.\n\n```go\nfunc NewObjectHeaderIter(name string, data []byte) (ObjectHeaderIter, error)\n```\nNewObjectHeaderIter returns an \\`ObjectHeaderIter\\` that iterates over the headers in a commit or tag object. \\`data\\` should be the object's contents, which is usually terminated by a blank line that separates the header from the comment. However, annotated tags don't always include comments, and Git even tolerates commits without comments, so don't insist on a blank line. \\`name\\` is used in error messages.\n\n```go\nfunc (iter *ObjectHeaderIter) HasNext() bool\n```\nHasNext returns true iff there are more headers to retrieve.\n\n```go\nfunc (iter *ObjectHeaderIter) Next() (string, string, error)\n```\nNext returns the key and value of the next header.\n\n```go\ntype ObjectIter struct {\n\t// contains filtered or unexported fields\n}\n```\nObjectIter iterates over objects in a Git repository.\n\n```go\nfunc (iter *ObjectIter) AddRoot(oid OID) error\n```\nAddRoot adds another OID to be included in the walk.\n\n```go\nfunc (iter *ObjectIter) Close()\n```\nClose closes the iterator and frees up resources.\n\n```go\nfunc (iter *ObjectIter) Next() (BatchHeader, bool, error)\n```\nNext returns either the next object (its OID, type, and size), or a \\`false\\` boolean value to indicate that there are no data left.\n\n```go\ntype ObjectRecord struct {\n\tBatchHeader\n\tData []byte\n}\n```\n\n```go\ntype ObjectType string\n```\nObjectType represents the type of a Git object (\"blob\", \"tree\", \"commit\", \"tag\", or \"missing\").\n\n```go\ntype Reference struct {\n\t// Refname is the full reference name of the reference.\n\tRefname string\n\n\t// ObjectType is the type of the object referenced.\n\tObjectType ObjectType\n\n\t// ObjectSize is the size of the referred-to object, in bytes.\n\tObjectSize counts.Count32\n\n\t// OID is the OID of the referred-to object.\n\tOID OID\n}\n```\nReference represents a Git reference.\n\n```go\nfunc ParseReference(line string) (Reference, error)\n```\nParseReference parses \\`line\\` (a non-LF-terminated line) into a \\`Reference\\`. It is assumed that \\`line\\` is formatted like the output of\n\n\tgit for-each-ref --format='%(objectname) %(objecttype) %(objectsize) %(refname)'\n\n```go\ntype ReferenceFilter interface {\n\tFilter(refname string) bool\n}\n```\n\n```go\nfunc PrefixFilter(prefix string) ReferenceFilter\n```\nPrefixFilter returns a \\`ReferenceFilter\\` that matches references whose names start with the specified \\`prefix\\`, which must match at a component boundary. For example,\n\n  - Prefix \"refs/foo\" matches \"refs/foo\" and \"refs/foo/bar\" but not \"refs/foobar\".\n\n  - Prefix \"refs/foo/\" matches \"refs/foo/bar\" but not \"refs/foo\" or \"refs/foobar\".\n\n```go\nfunc RegexpFilter(pattern string) (ReferenceFilter, error)\n```\nRegexpFilter returns a \\`ReferenceFilter\\` that matches references whose names match the specified \\`prefix\\`, which must match the whole reference name.\n\n```go\ntype ReferenceIter struct {\n\t// contains filtered or unexported fields\n}\n```\nReferenceIter is an iterator that interates over references.\n\n```go\nfunc (iter *ReferenceIter) Next() (Reference, bool, error)\n```\nNext returns either the next reference or a boolean \\`false\\` value indicating that the iteration is over. On errors, return an error (in this case, the caller must still call \\`Close()\\`).\n\n```go\ntype Repository struct {\n\t// contains filtered or unexported fields\n}\n```\nRepository represents a Git repository on disk.\n\n```go\nfunc NewRepositoryFromGitDir(gitDir string) (*Repository, error)\n```\nNewRepositoryFromGitDir creates a new \\`Repository\\` object that can be used for running \\`git\\` commands, given the value of \\`GIT\\_DIR\\` for the repository.\n\n```go\nfunc NewRepositoryFromPath(path string) (*Repository, error)\n```\nNewRepositoryFromPath creates a new \\`Repository\\` object that can be used for running \\`git\\` commands within \\`path\\`. It does so by asking \\`git\\` what \\`GIT\\_DIR\\` to use. Git, in turn, bases its decision on the path and the environment.\n\n```go\nfunc (repo *Repository) ConfigBoolDefault(key string, defaultValue bool) (bool, error)\n```\n\n```go\nfunc (repo *Repository) ConfigIntDefault(key string, defaultValue int) (int, error)\n```\n\n```go\nfunc (repo *Repository) ConfigStringDefault(key string, defaultValue string) (string, error)\n```\n\n```go\nfunc (repo *Repository) GetConfig(prefix string) (*Config, error)\n```\nGetConfig returns the entries from gitconfig. If \\`prefix\\` is provided, then only include entries in that section, which must match the at a component boundary (as defined by \\`configKeyMatchesPrefix()\\`), and strip off the prefix in the keys that are returned.\n\n```go\nfunc (repo *Repository) GitCommand(callerArgs ...string) *exec.Cmd\n```\n\n```go\nfunc (repo *Repository) GitDir() string\n```\nGitDir returns the path to \\`repo\\`'s \\`GIT\\_DIR\\`. It might be absolute or it might be relative to the current directory.\n\n```go\nfunc (repo *Repository) GitPath(relPath string) (string, error)\n```\nGitPath returns that path of a file within the git repository, by calling \\`git rev-parse --git-path $relPath\\`. The returned path is relative to the current directory.\n\n```go\nfunc (repo *Repository) HashAlgo() HashAlgo\n```\n\n```go\nfunc (repo *Repository) HashSize() int\n```\n\n```go\nfunc (repo *Repository) IsFull() (bool, error)\n```\nIsFull returns \\`true\\` iff \\`repo\\` appears to be a full clone.\n\n```go\nfunc (repo *Repository) NewBatchObjectIter(ctx context.Context) (*BatchObjectIter, error)\n```\nNewBatchObjectIter returns a \\`\\*BatchObjectIterator\\` and an \\`io.WriteCloser\\`. The iterator iterates over objects whose names are fed into the \\`io.WriteCloser\\`, one per line. The \\`io.WriteCloser\\` should normally be closed and the iterator's output drained before \\`Close()\\` is called.\n\n```go\nfunc (repo *Repository) NewObjectIter(ctx context.Context) (*ObjectIter, error)\n```\nNewObjectIter returns an iterator that iterates over objects in \\`repo\\`. The arguments are passed to \\`git rev-list --objects\\`. The second return value is the stdin of the \\`rev-list\\` command. The caller can feed values into it but must close it in any case.\n\n```go\nfunc (repo *Repository) NewReferenceIter(ctx context.Context) (*ReferenceIter, error)\n```\nNewReferenceIter returns an iterator that iterates over all of the references in \\`repo\\`.\n\n```go\nfunc (repo *Repository) NullOID() OID\n```\n\n```go\nfunc (repo *Repository) ResolveObject(name string) (OID, error)\n```\n\n```go\ntype Tag struct {\n\tSize         counts.Count32\n\tReferent     OID\n\tReferentType ObjectType\n}\n```\nTag represents the information that we need about a Git tag object.\n\n```go\nfunc ParseTag(oid OID, data []byte) (*Tag, error)\n```\nParseTag parses the Git tag object whose contents are contained in \\`data\\`. \\`oid\\` is used only in error messages.\n\n```go\ntype Tree struct {\n\t// contains filtered or unexported fields\n}\n```\nTree represents a Git tree object.\n\n```go\nfunc ParseTree(oid OID, data []byte) (*Tree, error)\n```\nParseTree parses the tree object whose contents are contained in \\`data\\`. \\`oid\\` is currently unused.\n\n```go\nfunc (tree *Tree) Iter() *TreeIter\n```\nIter returns an iterator over the entries in \\`tree\\`.\n\n```go\nfunc (tree Tree) Size() counts.Count32\n```\nSize returns the size of the tree object.\n\n```go\ntype TreeEntry struct {\n\tName     string\n\tOID      OID\n\tFilemode uint\n}\n```\nTreeEntry represents an entry in a Git tree object. Note that Name shares memory with the tree data that were originally read; i.e., retaining a pointer to Name keeps the tree data reachable.\n\n```go\ntype TreeIter struct {\n\t// contains filtered or unexported fields\n}\n```\nTreeIter is an iterator over the entries in a Git tree object.\n\n```go\nfunc (iter *TreeIter) NextEntry() (TreeEntry, bool, error)\n```\nNextEntry returns either the next entry in a Git tree, or a \\`false\\` boolean value if there are no more entries.\n\n","path":"github.com/github/git-sizer/git","name":"git","synopsis":"","isRedistributable":true}
