mirror of
https://github.com/octoleo/restic.git
synced 2024-11-18 19:15:14 +00:00
Treat changed files as a warning, not an error
This commit is contained in:
parent
3fcbb4ac25
commit
e6a40af06d
@ -431,10 +431,9 @@ func runBackup(opts BackupOptions, gopts GlobalOptions, args []string) error {
|
|||||||
arch.Excludes = opts.Excludes
|
arch.Excludes = opts.Excludes
|
||||||
arch.SelectFilter = selectFilter
|
arch.SelectFilter = selectFilter
|
||||||
|
|
||||||
arch.Error = func(dir string, fi os.FileInfo, err error) error {
|
arch.Warn = func(dir string, fi os.FileInfo, err error) {
|
||||||
// TODO: make ignoring errors configurable
|
// TODO: make ignoring errors configurable
|
||||||
Warnf("%s\rerror for %s: %v\n", ClearLine(), dir, err)
|
Warnf("%s\rwarning for %s: %v\n", ClearLine(), dir, err)
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_, id, err := arch.Snapshot(newArchiveProgress(gopts, stat), target, opts.Tags, parentSnapshotID)
|
_, id, err := arch.Snapshot(newArchiveProgress(gopts, stat), target, opts.Tags, parentSnapshotID)
|
||||||
|
@ -26,7 +26,9 @@ const (
|
|||||||
maxConcurrency = 10
|
maxConcurrency = 10
|
||||||
)
|
)
|
||||||
|
|
||||||
var archiverAbortOnAllErrors = func(str string, fi os.FileInfo, err error) error { return err }
|
var archiverPrintWarnings = func(path string, fi os.FileInfo, err error) {
|
||||||
|
fmt.Fprintf(os.Stderr, "warning for %v: %v", path, err)
|
||||||
|
}
|
||||||
var archiverAllowAllFiles = func(string, os.FileInfo) bool { return true }
|
var archiverAllowAllFiles = func(string, os.FileInfo) bool { return true }
|
||||||
|
|
||||||
// Archiver is used to backup a set of directories.
|
// Archiver is used to backup a set of directories.
|
||||||
@ -39,7 +41,7 @@ type Archiver struct {
|
|||||||
|
|
||||||
blobToken chan struct{}
|
blobToken chan struct{}
|
||||||
|
|
||||||
Error func(dir string, fi os.FileInfo, err error) error
|
Warn func(dir string, fi os.FileInfo, err error)
|
||||||
SelectFilter pipe.SelectFunc
|
SelectFilter pipe.SelectFunc
|
||||||
Excludes []string
|
Excludes []string
|
||||||
}
|
}
|
||||||
@ -61,7 +63,7 @@ func New(repo restic.Repository) *Archiver {
|
|||||||
arch.blobToken <- struct{}{}
|
arch.blobToken <- struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
arch.Error = archiverAbortOnAllErrors
|
arch.Warn = archiverPrintWarnings
|
||||||
arch.SelectFilter = archiverAllowAllFiles
|
arch.SelectFilter = archiverAllowAllFiles
|
||||||
|
|
||||||
return arch
|
return arch
|
||||||
@ -135,10 +137,7 @@ func (arch *Archiver) reloadFileIfChanged(node *restic.Node, file fs.File) (*res
|
|||||||
return node, nil
|
return node, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
err = arch.Error(node.Path, fi, errors.New("file has changed"))
|
arch.Warn(node.Path, fi, errors.New("file has changed"))
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
node, err = restic.NodeFromFileInfo(node.Path, fi)
|
node, err = restic.NodeFromFileInfo(node.Path, fi)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user