mirror of
https://github.com/octoleo/restic.git
synced 2024-11-18 11:05:18 +00:00
Merge pull request #700 from restic/debug-panic
Make sure SaveFile always returns a node
This commit is contained in:
commit
75f21f23ff
@ -210,14 +210,14 @@ func (arch *Archiver) SaveFile(p *restic.Progress, node *restic.Node) (*restic.N
|
|||||||
file, err := fs.Open(node.Path)
|
file, err := fs.Open(node.Path)
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "Open")
|
return node, errors.Wrap(err, "Open")
|
||||||
}
|
}
|
||||||
|
|
||||||
debug.RunHook("archiver.SaveFile", node.Path)
|
debug.RunHook("archiver.SaveFile", node.Path)
|
||||||
|
|
||||||
node, err = arch.reloadFileIfChanged(node, file)
|
node, err = arch.reloadFileIfChanged(node, file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return node, err
|
||||||
}
|
}
|
||||||
|
|
||||||
chnker := chunker.New(file, arch.repo.Config().ChunkerPolynomial)
|
chnker := chunker.New(file, arch.repo.Config().ChunkerPolynomial)
|
||||||
@ -230,7 +230,7 @@ func (arch *Archiver) SaveFile(p *restic.Progress, node *restic.Node) (*restic.N
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "chunker.Next")
|
return node, errors.Wrap(err, "chunker.Next")
|
||||||
}
|
}
|
||||||
|
|
||||||
resCh := make(chan saveResult, 1)
|
resCh := make(chan saveResult, 1)
|
||||||
@ -240,7 +240,7 @@ func (arch *Archiver) SaveFile(p *restic.Progress, node *restic.Node) (*restic.N
|
|||||||
|
|
||||||
results, err := waitForResults(resultChannels)
|
results, err := waitForResults(resultChannels)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return node, err
|
||||||
}
|
}
|
||||||
err = updateNodeContent(node, results)
|
err = updateNodeContent(node, results)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user