repository: remove redundant cleanup code

The temp files used by the packer manager are either delete after
creation (unix) or marked as delete on close (windows). Thus, no
explicit cleanup is necessary.
This commit is contained in:
Michael Eischer committed 2024-08-31 17:37:25 +02:00
1 parent 0ddb4441d7
commit 80ed863aab
2 files changed
-18

No files matched your search

-9
View File
@@ -6,7 +6,6 @@ import (
"crypto/sha256"
"io"
"os"
"runtime"
"sync"
"github.com/restic/restic/internal/backend"
@@ -186,14 +185,6 @@ func (r *Repository) savePacker(ctx context.Context, t restic.BlobType, p *packe
return errors.Wrap(err, "close tempfile")
}
// on windows the tempfile is automatically deleted on close
if runtime.GOOS != "windows" {
err = fs.RemoveIfExists(p.tmpfile.Name())
if err != nil {
return errors.WithStack(err)
}
}
// update blobs in the index
debug.Log(" updating blobs %v to pack %v", p.Packer.Blobs(), id)
r.idx.StorePack(id, p.Packer.Blobs())