diff options
| author | 2026-03-10 14:07:54 +0800 | |
|---|---|---|
| committer | 2026-03-10 14:07:54 +0800 | |
| commit | c2cb06aa23a1769a0d84756acccf1ac1358f61ef (patch) | |
| tree | 86d991b67542dd8e8509a74c832b749ccf948342 /format/pack/ingest/hash.go | |
| parent | commitgraph: Move out of format/ (diff) | |
| signature | No signature | |
*: format/pack -> packfile; format/delta -> delta; delete format
Diffstat (limited to 'format/pack/ingest/hash.go')
| -rw-r--r-- | format/pack/ingest/hash.go | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/format/pack/ingest/hash.go b/format/pack/ingest/hash.go deleted file mode 100644 index 8d4dac21..00000000 --- a/format/pack/ingest/hash.go +++ /dev/null @@ -1,27 +0,0 @@ -package ingest - -import ( - "fmt" - - "codeberg.org/lindenii/furgit/objectheader" - "codeberg.org/lindenii/furgit/objectid" - "codeberg.org/lindenii/furgit/objecttype" -) - -// 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("format/pack/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)) -} |
