diff options
| author | 2025-11-16 00:00:00 +0000 | |
|---|---|---|
| committer | 2025-11-16 00:00:00 +0000 | |
| commit | 43c25d457becb64ed2f76fbe2935475056a1081a (patch) | |
| tree | d2cda5f0912ee3cd733aeda626096bd64115eabb /obj_blob.go | |
| parent | Separate stored object types from types that the user is expected to construct. (diff) | |
| signature | ||
Documentation overhaul
Diffstat (limited to 'obj_blob.go')
| -rw-r--r-- | obj_blob.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/obj_blob.go b/obj_blob.go index 6a987604..05fd5311 100644 --- a/obj_blob.go +++ b/obj_blob.go @@ -1,6 +1,6 @@ package furgit -// Blob represents the contents of a Git blob. +// Blob represents a Git blob object. type Blob struct { Data []byte } @@ -16,7 +16,9 @@ func (sBlob *StoredBlob) Hash() Hash { return sBlob.hash } -// ObjectType allows Blob to satisfy the Object interface. +// ObjectType returns the object type of the blob. +// +// It always returns ObjectTypeBlob. func (blob *Blob) ObjectType() ObjectType { _ = blob return ObjectTypeBlob @@ -32,7 +34,8 @@ func parseBlob(id Hash, body []byte) (*StoredBlob, error) { }, nil } -// Serialize renders the full "blob size\\0body" representation. +// Serialize renders the blob into its raw byte representation, +// including the header (i.e., "type size\0"). func (blob *Blob) Serialize() ([]byte, error) { header, err := headerForType(ObjectTypeBlob, blob.Data) if err != nil { |
