diff options
| author | 2026-03-29 11:05:46 +0000 | |
|---|---|---|
| committer | 2026-03-29 11:05:46 +0000 | |
| commit | 0109f0903d8e18d110d6b9456f9a1fb4501e62fc (patch) | |
| tree | f1b95c7c64d79fa0dab0251661600a299d8aefcb /format/packfile/ingest | |
| parent | object{,/type}: Fix up API shape (diff) | |
| signature | No signature | |
object/type, format/packfile: API cleanups
Diffstat (limited to 'format/packfile/ingest')
| -rw-r--r-- | format/packfile/ingest/drain.go | 3 | ||||
| -rw-r--r-- | format/packfile/ingest/entry.go | 3 | ||||
| -rw-r--r-- | format/packfile/ingest/header.go | 2 | ||||
| -rw-r--r-- | format/packfile/ingest/record_content.go | 3 | ||||
| -rw-r--r-- | format/packfile/ingest/record_resolve.go | 3 |
5 files changed, 5 insertions, 9 deletions
diff --git a/format/packfile/ingest/drain.go b/format/packfile/ingest/drain.go index aa96db8a..7179a823 100644 --- a/format/packfile/ingest/drain.go +++ b/format/packfile/ingest/drain.go @@ -4,7 +4,6 @@ import ( "fmt" "io" - packfmt "codeberg.org/lindenii/furgit/format/packfile" "codeberg.org/lindenii/furgit/internal/compress/zlib" objectheader "codeberg.org/lindenii/furgit/object/header" objectid "codeberg.org/lindenii/furgit/object/id" @@ -25,7 +24,7 @@ func drainEntryPayload(state *ingestState, record objectRecord) (int64, objectid var total int64 - if packfmt.IsBaseObjectType(record.packedType) { + if record.packedType.IsBaseObject() { header, ok := objectheader.Encode(record.packedType, record.declaredSize) if !ok { return 0, zero, &MalformedPackEntryError{Offset: record.offset, Reason: "encode object header"} diff --git a/format/packfile/ingest/entry.go b/format/packfile/ingest/entry.go index 50fbe728..363e213c 100644 --- a/format/packfile/ingest/entry.go +++ b/format/packfile/ingest/entry.go @@ -3,7 +3,6 @@ package ingest import ( "fmt" - packfmt "codeberg.org/lindenii/furgit/format/packfile" objecttype "codeberg.org/lindenii/furgit/object/type" ) @@ -54,7 +53,7 @@ func scanOneEntry(state *ingestState, startOffset uint64) (uint64, error) { record.crc32 = crc - if packfmt.IsBaseObjectType(record.packedType) { + if record.packedType.IsBaseObject() { record.objectID = oid record.realType = record.packedType record.resolved = true diff --git a/format/packfile/ingest/header.go b/format/packfile/ingest/header.go index 6a214828..5fae4c41 100644 --- a/format/packfile/ingest/header.go +++ b/format/packfile/ingest/header.go @@ -36,7 +36,7 @@ func parseAndValidatePackHeader(hdr [packHeaderSize]byte) (HeaderInfo, error) { } version := binary.BigEndian.Uint32(hdr[4:8]) - if !packfile.VersionSupported(version) { + if !packfile.SupportedVersion(version) { return HeaderInfo{}, &InvalidPackHeaderError{ Reason: fmt.Sprintf("unsupported version %d", version), } diff --git a/format/packfile/ingest/record_content.go b/format/packfile/ingest/record_content.go index 4f8787ea..c66a1234 100644 --- a/format/packfile/ingest/record_content.go +++ b/format/packfile/ingest/record_content.go @@ -3,14 +3,13 @@ package ingest import ( "fmt" - packfmt "codeberg.org/lindenii/furgit/format/packfile" objecttype "codeberg.org/lindenii/furgit/object/type" ) // readBaseRecordContent reads canonical base content for one non-delta record. func readBaseRecordContent(state *ingestState, idx int) (objecttype.Type, []byte, error) { record := state.records[idx] - if !packfmt.IsBaseObjectType(record.packedType) { + if !record.packedType.IsBaseObject() { return objecttype.TypeInvalid, nil, fmt.Errorf("packfile/ingest: record %d is not a base object", idx) } diff --git a/format/packfile/ingest/record_resolve.go b/format/packfile/ingest/record_resolve.go index fc5b9dca..7a9471dc 100644 --- a/format/packfile/ingest/record_resolve.go +++ b/format/packfile/ingest/record_resolve.go @@ -3,7 +3,6 @@ package ingest import ( "fmt" - packfmt "codeberg.org/lindenii/furgit/format/packfile" objecttype "codeberg.org/lindenii/furgit/object/type" ) @@ -25,7 +24,7 @@ func resolveRecord(state *ingestState, idx int, visiting map[int]struct{}) (obje return ty, content, nil } - if packfmt.IsBaseObjectType(record.packedType) { + if record.packedType.IsBaseObject() { ty, content, err := readBaseRecordContent(state, idx) if err != nil { return objecttype.TypeInvalid, nil, err |
