diff options
| author | 2026-03-08 15:16:13 +0800 | |
|---|---|---|
| committer | 2026-03-08 15:16:13 +0800 | |
| commit | 668ce2a39f008d8b7f562621896108939d4e0608 (patch) | |
| tree | ee355e34c80198f4cf6df4e24c6b37cab43b82f2 /format/pack/ingest/thin_fix.go | |
| parent | format/pack/ingest: Write index progress too (diff) | |
| signature | No signature | |
format/pack/ingest: Thin fix error handling
Diffstat (limited to 'format/pack/ingest/thin_fix.go')
| -rw-r--r-- | format/pack/ingest/thin_fix.go | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/format/pack/ingest/thin_fix.go b/format/pack/ingest/thin_fix.go index 22c237d2..9dc65475 100644 --- a/format/pack/ingest/thin_fix.go +++ b/format/pack/ingest/thin_fix.go @@ -1,10 +1,12 @@ package ingest import ( + "errors" "fmt" "codeberg.org/lindenii/furgit/internal/intconv" "codeberg.org/lindenii/furgit/internal/progress" + "codeberg.org/lindenii/furgit/objectstore" ) // maybeFixThin appends missing bases and rewrites pack header/trailer when needed. @@ -61,13 +63,18 @@ func maybeFixThin(state *ingestState) error { Flush: state.opts.ProgressFlush, Title: "fixing thin pack", Total: uint64(total), - Sparse: true, }) - for i, id := range baseIDs { + var appended uint64 + + for _, id := range baseIDs { ty, content, err := state.opts.Base.ReadBytesContent(id) if err != nil { - continue + if errors.Is(err, objectstore.ErrObjectNotFound) { + continue + } + + return fmt.Errorf("format/pack/ingest: read thin base %s: %w", id, err) } _, err = appendBaseObject(state, id, ty, content) @@ -77,8 +84,8 @@ func maybeFixThin(state *ingestState) error { state.thinFixed = true - done := i + 1 - meter.Set(uint64(done), 0) + appended++ + meter.Set(appended, 0) } err = rewritePackHeaderAndTrailer(state) |
