Merge pull request #4978 from konidev20/fix-gh-4949-repair-index-spurious-index

rewrite: skip saving empty indexes during MasterIndex.Rewrite
This commit is contained in:
Michael Eischer 2024-08-03 18:53:57 +00:00 committed by GitHub
commit d2f7c5a9c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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