forked from TrueCloudLab/restic
Store empty list of blobs for empty files
This commit is contained in:
parent
c0b3021494
commit
4246e7602f
1 changed files with 12 additions and 7 deletions
|
@ -171,6 +171,10 @@ func (arch *Archiver) SaveFile(node *Node) error {
|
||||||
return arrar.Annotate(err, "SaveFile() read small file")
|
return arrar.Annotate(err, "SaveFile() read small file")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err == io.EOF {
|
||||||
|
// use empty blob list for empty files
|
||||||
|
blobs = Blobs{}
|
||||||
|
} else {
|
||||||
blob, err := arch.ch.Save(backend.Data, buf[:n])
|
blob, err := arch.ch.Save(backend.Data, buf[:n])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return arrar.Annotate(err, "SaveFile() save chunk")
|
return arrar.Annotate(err, "SaveFile() save chunk")
|
||||||
|
@ -179,6 +183,7 @@ func (arch *Archiver) SaveFile(node *Node) error {
|
||||||
arch.update(arch.SaveStats, Stats{Bytes: blob.Size})
|
arch.update(arch.SaveStats, Stats{Bytes: blob.Size})
|
||||||
|
|
||||||
blobs = Blobs{blob}
|
blobs = Blobs{blob}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// else store all chunks
|
// else store all chunks
|
||||||
chnker := chunker.New(file)
|
chnker := chunker.New(file)
|
||||||
|
|
Loading…
Add table
Reference in a new issue