From 1a7dc68faded3f77a171d9d640542524ad8f3bd5 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sat, 21 Feb 2026 03:57:04 +0800 Subject: objectstore: Clarify the hash contract in ReadBytesFull --- objectstore/objectstore.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) -- cgit v1.3.1-10-gc9f91