aboutsummaryrefslogtreecommitdiff
path: root/format/pack/ingest/thin_fix.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-08 03:31:12 +0800
committerGravatar Runxi Yu2026-03-08 03:31:12 +0800
commit74584d2dee4f349b5b3535669fa304b95f0f6e52 (patch)
tree8ce22050c4726eeaffa29f34074bf8f874c51c7c /format/pack/ingest/thin_fix.go
parentreceivepack: Add basic progress logging (diff)
signatureNo signature
format/pack/ingest: Add more progress
Diffstat (limited to 'format/pack/ingest/thin_fix.go')
-rw-r--r--format/pack/ingest/thin_fix.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/format/pack/ingest/thin_fix.go b/format/pack/ingest/thin_fix.go
index cdee8748..42e356b6 100644
--- a/format/pack/ingest/thin_fix.go
+++ b/format/pack/ingest/thin_fix.go
@@ -4,6 +4,7 @@ import (
"fmt"
"codeberg.org/lindenii/furgit/internal/intconv"
+ "codeberg.org/lindenii/furgit/internal/utils"
)
// maybeFixThin appends missing bases and rewrites pack header/trailer when needed.
@@ -12,6 +13,12 @@ func maybeFixThin(state *ingestState) error {
return nil
}
+ utils.WriteProgressf(
+ state.opts.Progress,
+ "fixing thin pack: %d unresolved bases\r",
+ len(state.unresolvedRefDeltas),
+ )
+
if !state.opts.FixThin {
return &ThinPackUnresolvedError{Count: len(state.unresolvedRefDeltas)}
}
@@ -47,7 +54,8 @@ func maybeFixThin(state *ingestState) error {
state.stream.consumed = consumed
baseIDs := unresolvedThinBaseIDs(state)
- for _, id := range baseIDs {
+ total := len(baseIDs)
+ for i, id := range baseIDs {
ty, content, err := state.opts.Base.ReadBytesContent(id)
if err != nil {
continue
@@ -59,6 +67,8 @@ func maybeFixThin(state *ingestState) error {
}
state.thinFixed = true
+
+ utils.WriteProgressf(state.opts.Progress, "fixing thin pack: %d/%d\r", i+1, total)
}
err = rewritePackHeaderAndTrailer(state)
@@ -66,5 +76,9 @@ func maybeFixThin(state *ingestState) error {
return err
}
+ if state.thinFixed {
+ utils.WriteProgressf(state.opts.Progress, "fixing thin pack: done.\n")
+ }
+
return nil
}