aboutsummaryrefslogtreecommitdiff
path: root/format/pack
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-05 21:05:56 +0800
committerGravatar Runxi Yu2026-03-05 21:05:56 +0800
commitf4ce6b4ee7c629b100c071e179af1bf22db73d70 (patch)
tree3b251327c6a600a30d0befb69ee1701c2cbb28c4 /format/pack
parent*: Fix lints (diff)
signatureNo signature
objectid, format/pack/ingest: Pack hash ID in algo
Diffstat (limited to 'format/pack')
-rw-r--r--format/pack/ingest/rev_write.go16
1 files changed, 1 insertions, 15 deletions
diff --git a/format/pack/ingest/rev_write.go b/format/pack/ingest/rev_write.go
index d7eab31f..afa9b4a9 100644
--- a/format/pack/ingest/rev_write.go
+++ b/format/pack/ingest/rev_write.go
@@ -3,8 +3,6 @@ package ingest
import (
"encoding/binary"
"slices"
-
- "codeberg.org/lindenii/furgit/objectid"
)
const (
@@ -47,7 +45,7 @@ func writeRev(state *ingestState) error {
return err
}
- binary.BigEndian.PutUint32(scratch[:4], hashID(state.algo))
+ binary.BigEndian.PutUint32(scratch[:4], state.algo.PackHashID())
err = writeAndHash(state.revFile, hashImpl, scratch[:4])
if err != nil {
@@ -101,15 +99,3 @@ func buildPackOrder(state *ingestState) []int {
return out
}
-
-// hashID converts object algorithm to pack hash-id encoding.
-func hashID(algo objectid.Algorithm) uint32 {
- switch algo {
- case objectid.AlgorithmSHA1:
- return 1
- case objectid.AlgorithmSHA256:
- return 2
- default:
- return 0
- }
-}