backup - show excluded files and directories in verbose mode - text/JSON (#21887)

This commit is contained in:
Winfried Plappert
2026-06-21 17:11:42 +01:00
committed by GitHub
parent 8d7679c831
commit d30d6b6281
9 changed files with 97 additions and 1 deletions
+15
View File
@@ -251,3 +251,18 @@ type summaryOutput struct {
SnapshotID string `json:"snapshot_id,omitempty"`
DryRun bool `json:"dry_run,omitempty"`
}
type VerboseExclude struct {
MessageType string `json:"message_type"` // "excluded_item"
Item string `json:"item"` // file or directory name
}
func (b *jsonProgress) ExcludedItem(path string) {
if b.v < 2 {
return
}
b.print(VerboseExclude{
MessageType: "excluded_item",
Item: path,
})
}
+5
View File
@@ -19,6 +19,7 @@ type ProgressPrinter interface {
ReportTotal(start time.Time, s archiver.ScanStats)
Finish(snapshotID restic.ID, summary *archiver.Summary, dryRun bool)
Reset()
ExcludedItem(path string)
restic.Printer
}
@@ -162,3 +163,7 @@ func (p *Progress) Finish(snapshotID restic.ID, summary *archiver.Summary, dryru
p.Updater.Done()
p.printer.Finish(snapshotID, summary, dryrun)
}
func (p *Progress) ExcludedItem(path string) {
p.printer.ExcludedItem(path)
}
+2 -1
View File
@@ -41,7 +41,8 @@ func (p *mockPrinter) Finish(id restic.ID, _ *archiver.Summary, _ bool) {
p.id = id
}
func (p *mockPrinter) Reset() {}
func (p *mockPrinter) Reset() {}
func (p *mockPrinter) ExcludedItem(_ string) {}
func TestProgress(t *testing.T) {
t.Parallel()
+4
View File
@@ -158,3 +158,7 @@ func (b *textProgress) Finish(id restic.ID, summary *archiver.Summary, dryRun bo
}
}
}
func (b *textProgress) ExcludedItem(path string) {
b.VV("excluded %s", path)
}