ref: a454068d748a363833df3a2219ac278bcaf4c39b
parent: b90593c9b83f71de343e27cd1b489dff79bd4ac7
author: Runxi Yu <runxiyu@umich.edu>
date: Tue Mar 24 02:10:36 EDT 2026
repository: Clarify ownership
--- a/repository/objects.go
+++ b/repository/objects.go
@@ -68,6 +68,10 @@
// Objects returns the configured object store.
//
+// The returned store is owned by Repository and borrows repository-managed
+// resources. Callers must not close it directly, and it must not be used after
+// Close.
+//
//nolint:ireturn
func (repo *Repository) Objects() objectstore.Store {return repo.objects
--- a/repository/refs.go
+++ b/repository/refs.go
@@ -4,6 +4,10 @@
// Refs returns the configured ref store.
//
+// The returned store is owned by Repository and borrows repository-managed
+// resources. Callers must not close it directly, and it must not be used after
+// Close.
+//
//nolint:ireturn
func (repo *Repository) Refs() refstore.ReadWriteStore {return repo.refs
--- a/repository/repository.go
+++ b/repository/repository.go
@@ -16,6 +16,10 @@
//
// Open expects a root for the Git directory itself:
// a bare repository root or a non-bare ".git" directory.
+//
+// Accessors such as Objects, Refs, Resolver, and LooseStoreForWriting return
+// views backed by resources owned by Repository. Those values borrow the
+// repository's stores and filesystem roots and must not be used after Close.
type Repository struct {config *config.Config
algo objectid.Algorithm
--- a/repository/resolver.go
+++ b/repository/resolver.go
@@ -4,8 +4,8 @@
// Resolver returns an object resolver backed by the repository's object store.
//
-// The returned resolver is ready for use and does not take ownership of the
-// repository or its underlying object store.
+// The returned resolver is ready for use, borrows the repository's object
+// store, does not need closing, and must not be used after Close.
func (repo *Repository) Resolver() *resolve.Resolver {return resolve.New(repo.objects)
}
--- a/repository/write_loose.go
+++ b/repository/write_loose.go
@@ -4,6 +4,11 @@
objectloose "codeberg.org/lindenii/furgit/objectstore/loose"
)
+// LooseStoreForWriting returns the repository's loose-object writer.
+//
+// The returned store is owned by Repository and borrows repository-managed
+// resources. Callers must not close it directly, and it must not be used after
+// Close.
func (repo *Repository) LooseStoreForWriting() *objectloose.Store {return repo.objectsLoose
}
--
⑨