Documentation ¶
Index ¶
- func NewThresholdFlagValue(threshold *Threshold, value Threshold) pflag.Value
- type BlobSize
- type CommitSize
- type Footnotes
- type Graph
- func (g *Graph) GetBlobSize(oid git.OID) BlobSize
- func (g *Graph) GetCommitSize(oid git.OID) CommitSize
- func (g *Graph) GetTreeSize(oid git.OID) TreeSize
- func (g *Graph) HistorySize() HistorySize
- func (g *Graph) RegisterBlob(oid git.OID, objectSize counts.Count32)
- func (g *Graph) RegisterCommit(oid git.OID, commit *git.Commit)
- func (g *Graph) RegisterReference(ref git.Reference, walked bool, groups []RefGroupSymbol)
- func (g *Graph) RegisterTag(oid git.OID, tag *git.Tag)
- func (g *Graph) RegisterTree(oid git.OID, tree *git.Tree) error
- func (g *Graph) RequireTagSize(oid git.OID, listener func(TagSize)) (TagSize, bool)
- func (g *Graph) RequireTreeSize(oid git.OID, listener func(TreeSize)) (TreeSize, bool)
- type HistorySize
- type InOrderPathResolver
- func (pr *InOrderPathResolver) ForgetPath(p *Path)
- func (pr *InOrderPathResolver) RecordCommit(oid, tree git.OID)
- func (pr *InOrderPathResolver) RecordReference(ref git.Reference)
- func (pr *InOrderPathResolver) RecordTag(oid git.OID, tag *git.Tag)
- func (pr *InOrderPathResolver) RecordTreeEntry(oid git.OID, name string, childOID git.OID)
- func (pr *InOrderPathResolver) RequestPath(oid git.OID, objectType string) *Path
- type NameStyle
- type NullPathResolver
- func (_ NullPathResolver) ForgetPath(p *Path)
- func (_ NullPathResolver) RecordCommit(oid, tree git.OID)
- func (_ NullPathResolver) RecordReference(ref git.Reference)
- func (_ NullPathResolver) RecordTag(oid git.OID, tag *git.Tag)
- func (_ NullPathResolver) RecordTreeEntry(oid git.OID, name string, childOID git.OID)
- func (n NullPathResolver) RequestPath(oid git.OID, objectType string) *Path
- type Path
- type PathResolver
- type RefGroup
- type RefGroupSymbol
- type RefGrouper
- type Size
- type TagSize
- type Threshold
- type TreeSize
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CommitSize ¶
type CommitSize struct { // The height of the ancestor graph, including this commit. MaxAncestorDepth counts.Count32 `json:"max_ancestor_depth"` }
func (CommitSize) String ¶
func (s CommitSize) String() string
type Footnotes ¶ added in v1.3.0
type Footnotes struct {
// contains filtered or unexported fields
}
Footnotes collects and numbers footnotes for a `table`.
func NewFootnotes ¶ added in v1.3.0
func NewFootnotes() *Footnotes
NewFootnotes creates and returns a new `Footnotes` instance.
func (*Footnotes) CreateCitation ¶ added in v1.3.0
CreateCitation adds a footnote with the specified text and returns the string that should be used to refer to it (e.g., "[2]"). If there is already a footnote with the exact same text, reuse its number.
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph is an object graph that is being built up.
func NewGraph ¶
func NewGraph(rg RefGrouper, nameStyle NameStyle) *Graph
NewGraph creates and returns a new `*Graph` instance.
func (*Graph) GetCommitSize ¶
func (g *Graph) GetCommitSize(oid git.OID) CommitSize
func (*Graph) HistorySize ¶
func (g *Graph) HistorySize() HistorySize
HistorySize returns the size data that have been collected.
func (*Graph) RegisterBlob ¶
RegisterBlob records that the specified `oid` is a blob with the specified size.
func (*Graph) RegisterCommit ¶
Record that the specified `oid` is the specified `commit`.
func (*Graph) RegisterReference ¶
func (g *Graph) RegisterReference(ref git.Reference, walked bool, groups []RefGroupSymbol)
RegisterReference records the specified reference in `g`.
func (*Graph) RegisterTag ¶
Record that the specified `oid` is the specified `tag`.
func (*Graph) RegisterTree ¶
Record that the specified `oid` is the specified `tree`.
func (*Graph) RequireTagSize ¶
type HistorySize ¶
type HistorySize struct { // The total number of unique commits analyzed. UniqueCommitCount counts.Count32 `json:"unique_commit_count"` // The total size of all commits analyzed. UniqueCommitSize counts.Count64 `json:"unique_commit_size"` // The maximum size of any analyzed commit. MaxCommitSize counts.Count32 `json:"max_commit_size"` // The commit with the maximum size. MaxCommitSizeCommit *Path `json:"max_commit,omitempty"` // The maximum ancestor depth of any analyzed commit. MaxHistoryDepth counts.Count32 `json:"max_history_depth"` // The maximum number of direct parents of any analyzed commit. MaxParentCount counts.Count32 `json:"max_parent_count"` // The commit with the maximum number of direct parents. MaxParentCountCommit *Path `json:"max_parent_count_commit,omitempty"` // The total number of unique trees analyzed. UniqueTreeCount counts.Count32 `json:"unique_tree_count"` // The total size of all trees analyzed. UniqueTreeSize counts.Count64 `json:"unique_tree_size"` // The total number of tree entries in all unique trees analyzed. UniqueTreeEntries counts.Count64 `json:"unique_tree_entries"` // The maximum number of entries an a tree. MaxTreeEntries counts.Count32 `json:"max_tree_entries"` // The tree with the maximum number of entries. MaxTreeEntriesTree *Path `json:"max_tree_entries_tree,omitempty"` // The total number of unique blobs analyzed. UniqueBlobCount counts.Count32 `json:"unique_blob_count"` // The total size of all of the unique blobs analyzed. UniqueBlobSize counts.Count64 `json:"unique_blob_size"` // The maximum size of any analyzed blob. MaxBlobSize counts.Count32 `json:"max_blob_size"` // The biggest blob found. MaxBlobSizeBlob *Path `json:"max_blob_size_blob,omitempty"` // The total number of unique tag objects analyzed. UniqueTagCount counts.Count32 `json:"unique_tag_count"` // The maximum number of tags in a chain. MaxTagDepth counts.Count32 `json:"max_tag_depth"` // The tag with the maximum tag depth. MaxTagDepthTag *Path `json:"max_tag_depth_tag,omitempty"` // The number of references analyzed. Note that we don't eliminate // duplicates if the user passes the same reference more than // once. ReferenceCount counts.Count32 `json:"reference_count"` // ReferenceGroups keeps track of how many references in each // reference group were scanned. ReferenceGroups map[RefGroupSymbol]*counts.Count32 `json:"reference_groups"` // The maximum depth of trees and blobs starting at this object // (not including this object). MaxPathDepth counts.Count32 `json:"max_path_depth"` // The tree with the maximum path depth. MaxPathDepthTree *Path `json:"max_path_depth_tree,omitempty"` // The maximum length of any path relative to this object, in // characters. MaxPathLength counts.Count32 `json:"max_path_length"` // The tree with the maximum path length. MaxPathLengthTree *Path `json:"max_path_length_tree,omitempty"` // The total number of trees, including duplicates. MaxExpandedTreeCount counts.Count32 `json:"max_expanded_tree_count"` // The tree with the maximum expanded tree count. MaxExpandedTreeCountTree *Path `json:"max_expanded_tree_count_tree,omitempty"` // The total number of blobs, including duplicates. MaxExpandedBlobCount counts.Count32 `json:"max_expanded_blob_count"` // The tree with the maximum expanded blob count. MaxExpandedBlobCountTree *Path `json:"max_expanded_blob_count_tree,omitempty"` // The total size of all blobs, including duplicates. MaxExpandedBlobSize counts.Count64 `json:"max_expanded_blob_size"` // The tree with the maximum expanded blob size. MaxExpandedBlobSizeTree *Path `json:"max_expanded_blob_size_tree,omitempty"` // The total number of symbolic links, including duplicates. MaxExpandedLinkCount counts.Count32 `json:"max_expanded_link_count"` // The tree with the maximum expanded link count. MaxExpandedLinkCountTree *Path `json:"max_expanded_link_count_tree,omitempty"` // The total number of submodules referenced, including duplicates. MaxExpandedSubmoduleCount counts.Count32 `json:"max_expanded_submodule_count"` // The tree with the maximum expanded submodule count. MaxExpandedSubmoduleCountTree *Path `json:"max_expanded_submodule_count_tree,omitempty"` }
func ScanRepositoryUsingGraph ¶
func ScanRepositoryUsingGraph( repo *git.Repository, rg RefGrouper, nameStyle NameStyle, progressMeter meter.Progress, ) (HistorySize, error)
ScanRepositoryUsingGraph scans `repo`, using `rg` to decide which references to scan and how to group them. `nameStyle` specifies whether the output should include full names, hashes only, or nothing in the footnotes. `progress` tells whether a progress meter should be displayed while it works.
It returns the size data for the repository.
func (*HistorySize) String ¶
func (s *HistorySize) String() string
func (*HistorySize) TableString ¶
func (s *HistorySize) TableString( refGroups []RefGroup, threshold Threshold, nameStyle NameStyle, ) string
type InOrderPathResolver ¶
type InOrderPathResolver struct {
// contains filtered or unexported fields
}
func (*InOrderPathResolver) ForgetPath ¶
func (pr *InOrderPathResolver) ForgetPath(p *Path)
Record that the specified path is wanted by one less seeker. If its seeker count goes to zero, remove it from `pr.soughtPaths`.
func (*InOrderPathResolver) RecordCommit ¶
func (pr *InOrderPathResolver) RecordCommit(oid, tree git.OID)
func (*InOrderPathResolver) RecordReference ¶
func (pr *InOrderPathResolver) RecordReference(ref git.Reference)
func (*InOrderPathResolver) RecordTag ¶
func (pr *InOrderPathResolver) RecordTag(oid git.OID, tag *git.Tag)
func (*InOrderPathResolver) RecordTreeEntry ¶
Record that the tree with OID `oid` has an entry with the specified `name` and `childOID`.
func (*InOrderPathResolver) RequestPath ¶
func (pr *InOrderPathResolver) RequestPath(oid git.OID, objectType string) *Path
Request that a path to the object named `oid` be computed.
type NullPathResolver ¶
type NullPathResolver struct {
// contains filtered or unexported fields
}
func (NullPathResolver) ForgetPath ¶
func (_ NullPathResolver) ForgetPath(p *Path)
func (NullPathResolver) RecordCommit ¶
func (_ NullPathResolver) RecordCommit(oid, tree git.OID)
func (NullPathResolver) RecordReference ¶
func (_ NullPathResolver) RecordReference(ref git.Reference)
func (NullPathResolver) RecordTreeEntry ¶
func (NullPathResolver) RequestPath ¶
func (n NullPathResolver) RequestPath(oid git.OID, objectType string) *Path
type Path ¶
type Path struct { // The OID of the object whose path we seek. This member is always // set. git.OID // contains filtered or unexported fields }
Structure for keeping track of an object whose path we want to know (e.g., the biggest blob, or a tree containing the biggest blob, or a commit whose tree contains the biggest blob). Valid states:
- `parent == nil && relativePath == ""`—we have not yet found anything that refers to this object.
- `parent != nil && relativePath == ""`—this object is a tree, and we have found a commit that refers to it.
- `parent == nil && relativePath != ""`—we have found a reference that points directly at this object; `relativePath` is the full name of the reference.
- `parent != nil && relativePath != ""`—this object is a blob or tree, and we have found another tree that refers to it; `relativePath` is the corresponding tree entry name.
func (*Path) MarshalJSON ¶
func (*Path) Path ¶
Return a human-readable path for this object if we can do better than its OID; otherwise, return "".
func (*Path) TreePrefix ¶
Return the path of this object under the assumption that another path component will be appended to it.
type PathResolver ¶
type PathResolver interface { RequestPath(oid git.OID, objectType string) *Path ForgetPath(p *Path) RecordReference(ref git.Reference) RecordTreeEntry(oid git.OID, name string, childOID git.OID) RecordCommit(oid, tree git.OID) RecordTag(oid git.OID, tag *git.Tag) }
PathResolver figures out a "reachability path" (i.e., Git `rev-parse` input, including commit and/or file path) by which specified objects are reachable. It is used as follows:
- Request an object's path using `RequestPath()`. The returned `Path` object is a placeholder for the object's path.
- Tell the `PathResolver` about objects that might be along the object's reachability path, *in depth-first* order (i.e., referents before referers) by calling `RecordTree()`, `RecordCommit()`, `RecordTag()`, and `RecordReference()`,.
* Read the path out of the `Path` object using `Path.Path()`.
Multiple objects can be processed at once.
It is important that interested is registered in an object's path via `RequestPath()` *before* any of the objects along its reachability path are recorded.
If a caller decides that it is not interested in a path after all, it can call `ForgetPath()`. This might free up some resources that would otherwise continue consuming memory.
func NewPathResolver ¶
func NewPathResolver(nameStyle NameStyle) PathResolver
type RefGroup ¶ added in v1.5.0
type RefGroup struct { // Symbol is the unique string by which this `RefGroup` is // identified and configured. It consists of dot-separated // components, which implicitly makes a nested tree-like // structure. Symbol RefGroupSymbol // Name is the name for this `ReferenceGroup` to be presented // in user-readable output. Name string }
RefGroup is a group of references, for example "branches" or "tags". Reference groups might overlap.
type RefGroupSymbol ¶ added in v1.5.0
type RefGroupSymbol string
RefGroupSymbol is the string "identifier" that is used to refer to a refgroup, for example in the gitconfig. Nesting of refgroups is inferred from their names, using "." as separator between components. For example, if there are three refgroups with symbols "tags", "tags.releases", and "foo.bar", then "tags.releases" is considered to be nested within "tags", and "foo.bar" is considered to be nested within "foo", the latter being created automatically if it was not configured explicitly.
type RefGrouper ¶ added in v1.5.0
type RefGrouper interface { // Categorize tells whether `refname` should be walked at all, // and if so, the symbols of the reference groups to which it // belongs. Categorize(refname string) (bool, []RefGroupSymbol) // Groups returns the list of `ReferenceGroup`s, in the order // that they should be presented. The return value might // depend on which references have been seen so far. Groups() []RefGroup }
RefGrouper describes a type that can collate reference names into groups and decide which ones to walk.
type TagSize ¶
type TreeSize ¶
type TreeSize struct { // The maximum depth of trees and blobs starting at this object // (not including this object). MaxPathDepth counts.Count32 `json:"max_path_depth"` // The maximum length of any path relative to this object, in // characters. MaxPathLength counts.Count32 `json:"max_path_length"` // The total number of trees, including duplicates. ExpandedTreeCount counts.Count32 `json:"expanded_tree_count"` // The total number of blobs, including duplicates. ExpandedBlobCount counts.Count32 `json:"expanded_blob_count"` // The total size of all blobs, including duplicates. ExpandedBlobSize counts.Count64 `json:"expanded_blob_size"` // The total number of symbolic links, including duplicates. ExpandedLinkCount counts.Count32 `json:"expanded_link_count"` // The total number of submodules referenced, including duplicates. ExpandedSubmoduleCount counts.Count32 `json:"expanded_submodule_count"` }