mirror of
https://github.com/octoleo/restic.git
synced 2024-10-31 19:02:32 +00:00
Store empty list of blobs for empty files
This commit is contained in:
parent
c0b3021494
commit
4246e7602f
19
archiver.go
19
archiver.go
@ -171,14 +171,19 @@ func (arch *Archiver) SaveFile(node *Node) error {
|
||||
return arrar.Annotate(err, "SaveFile() read small file")
|
||||
}
|
||||
|
||||
blob, err := arch.ch.Save(backend.Data, buf[:n])
|
||||
if err != nil {
|
||||
return arrar.Annotate(err, "SaveFile() save chunk")
|
||||
if err == io.EOF {
|
||||
// use empty blob list for empty files
|
||||
blobs = Blobs{}
|
||||
} else {
|
||||
blob, err := arch.ch.Save(backend.Data, buf[:n])
|
||||
if err != nil {
|
||||
return arrar.Annotate(err, "SaveFile() save chunk")
|
||||
}
|
||||
|
||||
arch.update(arch.SaveStats, Stats{Bytes: blob.Size})
|
||||
|
||||
blobs = Blobs{blob}
|
||||
}
|
||||
|
||||
arch.update(arch.SaveStats, Stats{Bytes: blob.Size})
|
||||
|
||||
blobs = Blobs{blob}
|
||||
} else {
|
||||
// else store all chunks
|
||||
chnker := chunker.New(file)
|
||||
|
Loading…
Reference in New Issue
Block a user