aboutsummaryrefslogtreecommitdiff
path: root/obj_blob.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2025-11-16 00:00:00 +0000
committerGravatar Runxi Yu2025-11-16 00:00:00 +0000
commit5cfbd8863dfb7c6af92497d9a5eb6eb63a6bd589 (patch)
tree42a871a72388bb6d40c479fbaa6eedde1cddc42e /obj_blob.go
parenthash: Generic hash-algorithm API (diff)
signature
Revert "hash: Generic hash-algorithm API"
This reverts commit 94bfb1fa147f80e6ec39009d41fc2f853925e0a5. Generics actually kinda suck for these purposes... once you look at it from the user's perspective.
Diffstat (limited to 'obj_blob.go')
-rw-r--r--obj_blob.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/obj_blob.go b/obj_blob.go
index 1f74464e..9edad0a9 100644
--- a/obj_blob.go
+++ b/obj_blob.go
@@ -1,26 +1,27 @@
package furgit
// Blob represents the contents of a Git blob.
-type Blob[T HashType] struct {
- Hash Hash[T]
+type Blob struct {
+ Hash Hash
+
Data []byte
}
// ObjType allows Blob to satisfy the Object interface.
-func (*Blob[T]) ObjType() ObjType {
+func (*Blob) ObjType() ObjType {
return ObjBlob
}
-func parseBlob[T HashType](id Hash[T], body []byte) (*Blob[T], error) {
+func parseBlob(id Hash, body []byte) (*Blob, error) {
data := append([]byte(nil), body...)
- return &Blob[T]{
+ return &Blob{
Hash: id,
Data: data,
}, nil
}
// Serialize renders the full "blob size\\0body" representation.
-func (b *Blob[T]) Serialize() ([]byte, error) {
+func (b *Blob) Serialize(hashSize int) ([]byte, error) {
header, err := headerForType(ObjBlob, b.Data)
if err != nil {
return nil, err