From d951176970f646b1cc2e586f8b5fda31c93365c5 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sat, 21 Feb 2026 19:00:01 +0800 Subject: objectstore/packed: Use constants/functions from format/pack --- objectstore/packed/pack.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'objectstore/packed/pack.go') diff --git a/objectstore/packed/pack.go b/objectstore/packed/pack.go index 00950159..9af4c860 100644 --- a/objectstore/packed/pack.go +++ b/objectstore/packed/pack.go @@ -6,11 +6,10 @@ import ( "os" "syscall" + packfmt "codeberg.org/lindenii/furgit/format/pack" "codeberg.org/lindenii/furgit/internal/intconv" ) -const packSignature = 0x5041434b - // packFile stores one mapped and validated .pack file. type packFile struct { // name is the .pack basename. @@ -37,12 +36,12 @@ func openPackFile(name string, file *os.File, size int64) (*packFile, error) { if err != nil { return nil, err } - if binary.BigEndian.Uint32(data[:4]) != packSignature { + if binary.BigEndian.Uint32(data[:4]) != packfmt.Signature { _ = syscall.Munmap(data) return nil, fmt.Errorf("objectstore/packed: pack %q invalid signature", name) } version := binary.BigEndian.Uint32(data[4:8]) - if version != 2 && version != 3 { + if !packfmt.VersionSupported(version) { _ = syscall.Munmap(data) return nil, fmt.Errorf("objectstore/packed: pack %q unsupported version %d", name, version) } -- cgit v1.3.1-10-gc9f91