aboutsummaryrefslogtreecommitdiff
path: root/format/packfile/ingest/hash.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-30 14:28:13 +0000
committerGravatar Runxi Yu2026-03-30 14:28:13 +0000
commita4eeb727468a178a4de0dfc718828f26740484ac (patch)
tree4318d38d49facc80e2e2186f5919fa656be3b31f /format/packfile/ingest/hash.go
parentobject/store/packed: Make store own root, algo, opts (diff)
signatureNo signature
object,store/packed{,/internal/ingest}: Move from format/packfile/ingest
Diffstat (limited to 'format/packfile/ingest/hash.go')
-rw-r--r--format/packfile/ingest/hash.go27
1 files changed, 0 insertions, 27 deletions
diff --git a/format/packfile/ingest/hash.go b/format/packfile/ingest/hash.go
deleted file mode 100644
index 4b739c20..00000000
--- a/format/packfile/ingest/hash.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package ingest
-
-import (
- "fmt"
-
- objectheader "codeberg.org/lindenii/furgit/object/header"
- objectid "codeberg.org/lindenii/furgit/object/id"
- objecttype "codeberg.org/lindenii/furgit/object/type"
-)
-
-// hashCanonicalObject hashes canonical object bytes (header+content).
-func hashCanonicalObject(algo objectid.Algorithm, ty objecttype.Type, content []byte) (objectid.ObjectID, error) {
- header, ok := objectheader.Encode(ty, int64(len(content)))
- if !ok {
- return objectid.ObjectID{}, fmt.Errorf("packfile/ingest: encode object header for type %d", ty)
- }
-
- hashImpl, err := algo.New()
- if err != nil {
- return objectid.ObjectID{}, err
- }
-
- _, _ = hashImpl.Write(header)
- _, _ = hashImpl.Write(content)
-
- return objectid.FromBytes(algo, hashImpl.Sum(nil))
-}