shithub: furgit

Download patch

ref: 1a7dc68faded3f77a171d9d640542524ad8f3bd5
parent: 27ee98e7a9a8693db59e755739e10c1c1ba852b4
author: Runxi Yu <me@runxiyu.org>
date: Fri Feb 20 22:57:04 EST 2026

objectstore: Clarify the hash contract in ReadBytesFull

--- a/objectstore/objectstore.go
+++ b/objectstore/objectstore.go
@@ -16,7 +16,10 @@
 // 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)
--