Fast implementation of Git in pure Go codeberg.org/lindenii/furgit
git go
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

repository: Add guidance

Runxi Yu 161d2fab 0eb5adaa

+36 -9
+5
repository/commit_graph.go
··· 31 31 32 32 // CommitGraph returns the configured commit-graph reader, if available. 33 33 // 34 + // Not all repositories have a commit-graph, so CommitGraph may return nil. 35 + // Most callers should prefer [Repository.CommitQueries] or 36 + // [Repository.Reachability] unless they specifically need direct 37 + // commit-graph access. 38 + // 34 39 // Labels: Life-Parent, Close-No. 35 40 func (repo *Repository) CommitGraph() *commitgraphread.Reader { 36 41 return repo.commitGraph
+2
repository/commit_queries.go
··· 5 5 // CommitQueries returns commit queries backed by the repository's object store 6 6 // and optional commit-graph. 7 7 // 8 + // Use CommitQueries for ancestor checks and merge-base computation. 9 + // 8 10 // Labels: Life-Parent, Close-No. 9 11 func (repo *Repository) CommitQueries() *commitquery.Queries { 10 12 return repo.commitQueries
+4
repository/fetcher.go
··· 4 4 5 5 // Fetcher returns an object fetcher backed by the repository's object store. 6 6 // 7 + // Use Fetcher when you want typed commits, trees, blobs, or tags, when you 8 + // need to peel through annotated tags, or when you want path-based access 9 + // within trees. 10 + // 7 11 // Labels: Life-Parent, Close-No. 8 12 func (repo *Repository) Fetcher() *fetch.Fetcher { 9 13 return fetch.New(repo.objects)
+4
repository/objects.go
··· 77 77 78 78 // Objects returns the configured object store. 79 79 // 80 + // Use Objects for direct object-ID lookups, object headers, sizes, raw object 81 + // bytes, or streamed object contents. Callers who want typed object values 82 + // should usually prefer [Repository.Fetcher]. 83 + // 80 84 // Labels: Life-Parent, Close-No. 81 85 // 82 86 //nolint:ireturn
+5 -1
repository/open.go
··· 8 8 reffiles "codeberg.org/lindenii/furgit/ref/store/files" 9 9 ) 10 10 11 - // Open opens a repository and wires object/ref stores from its on-disk format. 11 + // Open opens a repository and wires its stores and helpers from the on-disk 12 + // repository format. 13 + // 14 + // root must refer to the Git directory itself: 15 + // a bare repository root or a non-bare ".git" directory. 12 16 // 13 17 // Labels: Deps-Borrowed. 14 18 func Open(root *os.Root) (repo *Repository, err error) {
+3
repository/reachability.go
··· 5 5 // Reachability returns graph traversal helpers backed by the repository's 6 6 // object store and optional commit-graph. 7 7 // 8 + // Use Reachability to walk reachable commits or objects and to perform 9 + // connectivity checks. 10 + // 8 11 // Labels: Life-Parent, Close-No. 9 12 func (repo *Repository) Reachability() *reachability.Reachability { 10 13 return reachability.New(repo.objects, repo.commitGraph)
+4
repository/refs.go
··· 4 4 5 5 // Refs returns the configured ref store. 6 6 // 7 + // Use Refs when starting from branch names, tags, HEAD, or other references. 8 + // A common pattern is to resolve a reference first and then pass the resulting 9 + // object ID to [Repository.Fetcher] or [Repository.Objects]. 10 + // 7 11 // Labels: Life-Parent, Close-No. 8 12 // 9 13 //nolint:ireturn
+9 -8
repository/repository.go
··· 1 - // Package repository opens stores and other objects to access a typical on-disk repo. 1 + // Package repository opens a typical on-disk Git repository and exposes its 2 + // main stores and helpers. 3 + // 4 + // Start with [Open] when working with a bare repository root or a non-bare 5 + // ".git" directory. [Repository] then provides access to ref storage, object 6 + // storage, typed object fetching, commit queries, reachability helpers, and 7 + // optional commit-graph access. 2 8 package repository 3 9 4 10 import ( ··· 14 20 refstore "codeberg.org/lindenii/furgit/ref/store" 15 21 ) 16 22 17 - // Repository represents a typical on-disk Git repository by composing 18 - // its stores together for access. 23 + // Repository represents a typical on-disk Git repository by composing its 24 + // stores and helpers together for access. 19 25 // 20 26 // Open expects a root for the Git directory itself: 21 27 // a bare repository root or a non-bare ".git" directory. 22 - // 23 - // Accessors such as [Repository.Objects], [Repository.CommitGraph], 24 - // [Repository.CommitQueries], [Repository.Reachability], [Repository.Refs], 25 - // [Repository.Fetcher], and [Repository.LooseStoreForWriting] return 26 - // repository-backed views. 27 28 // 28 29 // Labels: MT-Safe, Close-Caller. 29 30 type Repository struct {