mirror of
https://github.com/octoleo/restic.git
synced 2024-12-22 10:58:55 +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")
|
return arrar.Annotate(err, "SaveFile() read small file")
|
||||||
}
|
}
|
||||||
|
|
||||||
blob, err := arch.ch.Save(backend.Data, buf[:n])
|
if err == io.EOF {
|
||||||
if err != nil {
|
// use empty blob list for empty files
|
||||||
return arrar.Annotate(err, "SaveFile() save chunk")
|
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 {
|
||||||
// else store all chunks
|
// else store all chunks
|
||||||
chnker := chunker.New(file)
|
chnker := chunker.New(file)
|
||||||
|
Loading…
Reference in New Issue
Block a user