From 84c2d0223fd06d707b36cae7abea48c965646751 Mon Sep 17 00:00:00 2001 From: Junker der Provinz <133605895+junkerderprovinz@users.noreply.github.com> Date: Wed, 21 Oct 2026 22:44:24 +0200 Subject: [PATCH 1/2] stats: keep progress counters across snapshots The file, blob and size counters were reset for every snapshot, so the progress line only reflected the last processed snapshot. Co-authored-by: Winfried Plappert <18740761+wplapper@users.noreply.github.com> --- changelog/unreleased/issue-22112 | 9 +++++++++ internal/ui/stats/progress.go | 3 --- internal/ui/stats/progress_test.go | 6 +++--- 3 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 changelog/unreleased/issue-22112 diff --git a/changelog/unreleased/issue-22112 b/changelog/unreleased/issue-22112 new file mode 100644 index 000000000..58f60f7e3 --- /dev/null +++ b/changelog/unreleased/issue-22112 @@ -0,0 +1,9 @@ +Bugfix: Fix `stats` progress bar resetting its counters for every snapshot + +The progress bar of `restic stats` reset its file, blob and size counters +at the start of each snapshot, so the final progress line only showed the +numbers for the last processed snapshot. These numbers varied between runs +depending on the order in which snapshots were processed. The progress bar +now counts across all selected snapshots. + +https://github.com/restic/restic/issues/22112 diff --git a/internal/ui/stats/progress.go b/internal/ui/stats/progress.go index 5f568070e..cace6a8c5 100644 --- a/internal/ui/stats/progress.go +++ b/internal/ui/stats/progress.go @@ -88,7 +88,4 @@ func (p *Progress) ProcessSnapshot() { defer p.m.Unlock() p.processedSnapshotCount++ - p.processedFileCount = 0 - p.processedBlobCount = 0 - p.processedSize = 0 } diff --git a/internal/ui/stats/progress_test.go b/internal/ui/stats/progress_test.go index 2508d0056..aed19282e 100644 --- a/internal/ui/stats/progress_test.go +++ b/internal/ui/stats/progress_test.go @@ -24,14 +24,14 @@ func TestStatsProgress(t *testing.T) { progress.ProcessSnapshot() progress.printProgress(10*time.Second, false) - rtest.Equals(t, []string{"[0:10] 50.00% 2 / 2 snapshots, 0 B"}, term.Output) + rtest.Equals(t, []string{"[0:10] 50.00% 2 / 2 snapshots, 1 files, 2 blobs, 3 B"}, term.Output) progress.Update(4, 5, 6) progress.printProgress(15*time.Second, false) - rtest.Equals(t, []string{"[0:15] 50.00% 2 / 2 snapshots, 4 files, 5 blobs, 6 B"}, term.Output) + rtest.Equals(t, []string{"[0:15] 50.00% 2 / 2 snapshots, 5 files, 7 blobs, 9 B"}, term.Output) progress.printProgress(20*time.Second, true) - rtest.Equals(t, []string{"[0:20] 100.00% 2 / 2 snapshots, 4 files, 5 blobs, 6 B"}, term.Output) + rtest.Equals(t, []string{"[0:20] 100.00% 2 / 2 snapshots, 5 files, 7 blobs, 9 B"}, term.Output) } func TestStatsProgressJSON(t *testing.T) { From e9a07fd773b778b963aaf85dc91bda432a2fad29 Mon Sep 17 00:00:00 2001 From: Junker der Provinz <133605895+junkerderprovinz@users.noreply.github.com> Date: Fri, 6 Nov 2026 01:09:05 +0100 Subject: [PATCH 2/2] changelog: link the pull request --- changelog/unreleased/issue-22112 | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog/unreleased/issue-22112 b/changelog/unreleased/issue-22112 index 58f60f7e3..1e077a92e 100644 --- a/changelog/unreleased/issue-22112 +++ b/changelog/unreleased/issue-22112 @@ -7,3 +7,4 @@ depending on the order in which snapshots were processed. The progress bar now counts across all selected snapshots. https://github.com/restic/restic/issues/22112 +https://github.com/restic/restic/pull/22130