diff options
| author | 2026-02-21 03:57:04 +0800 | |
|---|---|---|
| committer | 2026-02-21 03:57:04 +0800 | |
| commit | 1a7dc68faded3f77a171d9d640542524ad8f3bd5 (patch) | |
| tree | 27fb876ad703418e5d795b2113d93e575702bda4 | |
| parent | objectstore/loose: Add loose backend (diff) | |
| signature | No signature | |
objectstore: Clarify the hash contract in ReadBytesFull
| -rw-r--r-- | objectstore/objectstore.go | 5 |
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) |
