Documentation
¶
Overview ¶
Package repository opens a typical on-disk Git repository and exposes its main stores and helpers.
Start with Open when working with a bare repository root or a non-bare ".git" directory. Repository then provides access to ref storage, object storage, typed object fetching, commit queries, reachability helpers, and optional commit-graph access.
Index ¶
- type Repository
- func (repo *Repository) Algorithm() objectid.Algorithm
- func (repo *Repository) Close() error
- func (repo *Repository) CommitGraph() *commitgraphread.Reader
- func (repo *Repository) CommitQueries() *commitquery.Queries
- func (repo *Repository) Config() *config.Config
- func (repo *Repository) Fetcher() *fetch.Fetcher
- func (repo *Repository) Objects() interface{ ... }
- func (repo *Repository) Reachability() *reachability.Reachability
- func (repo *Repository) Refs() interface{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository represents a typical on-disk Git repository by composing its stores and helpers together for access.
Open expects a root for the Git directory itself: a bare repository root or a non-bare ".git" directory.
Labels: MT-Safe, Close-Caller.
func Open ¶
func Open(root *os.Root) (repo *Repository, err error)
Open opens a repository and wires its stores and helpers from the on-disk repository format.
root must refer to the Git directory itself: a bare repository root or a non-bare ".git" directory.
Labels: Deps-Borrowed.
func (*Repository) Algorithm ¶
func (repo *Repository) Algorithm() objectid.Algorithm
Algorithm returns the repository object ID algorithm.
func (*Repository) Close ¶
func (repo *Repository) Close() error
Close closes repository-owned stores and filesystem roots.
Labels: MT-Unsafe.
func (*Repository) CommitGraph ¶ added in v0.1.122
func (repo *Repository) CommitGraph() *commitgraphread.Reader
CommitGraph returns the configured commit-graph reader, if available.
Not all repositories have a commit-graph, so CommitGraph may return nil. Most callers should prefer Repository.CommitQueries or Repository.Reachability unless they specifically need direct commit-graph access.
Labels: Life-Parent, Close-No.
func (*Repository) CommitQueries ¶ added in v0.1.122
func (repo *Repository) CommitQueries() *commitquery.Queries
CommitQueries returns commit queries backed by the repository's object store and optional commit-graph.
Use CommitQueries for ancestor checks and merge-base computation.
Labels: Life-Parent.
func (*Repository) Config ¶
func (repo *Repository) Config() *config.Config
Config returns the parsed repository configuration snapshot.
The returned pointer is owned by Repository. Callers should treat it as read-only.
func (*Repository) Fetcher ¶ added in v0.1.119
func (repo *Repository) Fetcher() *fetch.Fetcher
Fetcher returns an object fetcher backed by the repository's object store.
Use Fetcher when you want typed commits, trees, blobs, or tags, when you need to peel through annotated tags, or when you want path-based access within trees.
Labels: Life-Parent.
func (*Repository) Objects ¶
func (repo *Repository) Objects() interface { objectstore.Reader objectstore.Writer objectstore.Quarantiner }
Objects returns the configured object store.
Use Objects for direct object-ID lookups, object headers, sizes, raw object bytes, streamed object contents, object writes, pack ingestion, and coordinated quarantines. Callers who want typed object values should usually prefer Repository.Fetcher.
Labels: Life-Parent.
func (*Repository) Reachability ¶ added in v0.1.125
func (repo *Repository) Reachability() *reachability.Reachability
Reachability returns graph traversal helpers backed by the repository's object store and optional commit-graph.
Use Reachability to walk reachable commits or objects and to perform connectivity checks.
Labels: Life-Parent.
func (*Repository) Refs ¶
func (repo *Repository) Refs() interface { refstore.Reader refstore.Transactioner refstore.Batcher }
Refs returns the configured ref store.
Use Refs when starting from branch names, tags, HEAD, or other references. A common pattern is to resolve a reference first and then pass the resulting object ID to Repository.Fetcher or Repository.Objects.
Labels: Life-Parent.