diff options
| author | 2026-02-21 19:00:01 +0800 | |
|---|---|---|
| committer | 2026-02-21 19:18:45 +0800 | |
| commit | d951176970f646b1cc2e586f8b5fda31c93365c5 (patch) | |
| tree | d2248307ae4b4b964f1661648964ac65f946e658 /objectstore/packed/pack.go | |
| parent | format/pack: Extract general constants and such from objectstore/packed (diff) | |
| signature | No signature | |
objectstore/packed: Use constants/functions from format/pack
Diffstat (limited to 'objectstore/packed/pack.go')
| -rw-r--r-- | objectstore/packed/pack.go | 7 |
1 files changed, 3 insertions, 4 deletions
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) } |
