rewrite: skip saving empty indexes during MasterIndex.Rewrite

This commit is contained in:
Srigovind Nayak 2024-08-03 23:34:59 +05:30
parent 8d5e188218
commit 068d5b95c3
No known key found for this signature in database
GPG key ID: 3C4A72A34ABD4C43

View file

@ -456,6 +456,9 @@ func (mi *MasterIndex) Rewrite(ctx context.Context, repo restic.Unpacked, exclud
worker := func() error { worker := func() error {
for idx := range saveCh { for idx := range saveCh {
idx.Finalize() idx.Finalize()
if len(idx.packs) == 0 {
continue
}
if _, err := idx.SaveIndex(wgCtx, repo); err != nil { if _, err := idx.SaveIndex(wgCtx, repo); err != nil {
return err return err
} }