aboutsummaryrefslogtreecommitdiff
path: root/objectstore/objectstore.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-02-21 03:57:04 +0800
committerGravatar Runxi Yu2026-02-21 03:57:04 +0800
commit1a7dc68faded3f77a171d9d640542524ad8f3bd5 (patch)
tree27fb876ad703418e5d795b2113d93e575702bda4 /objectstore/objectstore.go
parentobjectstore/loose: Add loose backend (diff)
signatureNo signature
objectstore: Clarify the hash contract in ReadBytesFull
Diffstat (limited to 'objectstore/objectstore.go')
-rw-r--r--objectstore/objectstore.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/objectstore/objectstore.go b/objectstore/objectstore.go
index 22ddffab..54760709 100644
--- a/objectstore/objectstore.go
+++ b/objectstore/objectstore.go
@@ -16,7 +16,10 @@ var ErrObjectNotFound = errors.New("objectstore: object not found")
// Store reads Git objects by object ID.
type Store interface {
// ReadBytesFull reads a full serialized object as "type size\\x00content".
- // If hashed with the same algorithm it MUST match the object ID.
+ //
+ // In a valid repository, hashing this payload with the same algorithm yields
+ // the requested object ID. Readers should treat this as a repository
+ // invariant and should not re-verify it on every read.
ReadBytesFull(id objectid.ObjectID) ([]byte, error)
// ReadBytesContent reads an object's type and content bytes.
ReadBytesContent(id objectid.ObjectID) (objecttype.Type, []byte, error)