aboutsummaryrefslogtreecommitdiff
path: root/packfile/ingest/hash.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-26 09:17:14 +0000
committerGravatar Runxi Yu2026-03-26 09:18:30 +0000
commit3e884f5f3d42cbc4874a04da31dde10314b0cfad (patch)
treef5e1e325fd1a2a0801791c054010213214475d80 /packfile/ingest/hash.go
parentnetwork/receivepack: Rename from receivepack (diff)
format: Move commitgraph and packfile here
Diffstat (limited to 'packfile/ingest/hash.go')
-rw-r--r--packfile/ingest/hash.go27
1 files changed, 0 insertions, 27 deletions
diff --git a/packfile/ingest/hash.go b/packfile/ingest/hash.go
deleted file mode 100644
index 4b739c20..00000000
--- a/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))
-}