diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-02-07 18:03:16 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-02-07 18:45:29 +0200 |
commit | 3ef5bd7a3ab445509216116bb2f8009ace2b1080 (patch) | |
tree | f9a176737e6b79f9c6977bdf98090041bca2f01e /src/cmd/restore.rs | |
parent | 5b863edb32314808b6823f90c03ad97da6fdbcbf (diff) | |
download | obnam2-3ef5bd7a3ab445509216116bb2f8009ace2b1080.tar.gz |
feat: if file can't be read, log that, don't end backup in error
Such files won't be restored, as they'd be restored as empty file, and
that would be confusing and thus bad.
Diffstat (limited to 'src/cmd/restore.rs')
-rw-r--r-- | src/cmd/restore.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cmd/restore.rs b/src/cmd/restore.rs index a0f5ec0..5d01bd4 100644 --- a/src/cmd/restore.rs +++ b/src/cmd/restore.rs @@ -1,3 +1,4 @@ +use crate::backup_reason::Reason; use crate::client::ClientConfig; use crate::client::{BackupClient, ClientError}; use crate::error::ObnamError; @@ -35,7 +36,10 @@ pub fn restore(config: &ClientConfig, gen_ref: &str, to: &Path) -> Result<(), Ob info!("restoring {} files", gen.file_count()?); let progress = create_progress_bar(gen.file_count()?, true); for file in gen.files()? { - restore_generation(&client, &gen, file.fileno(), file.entry(), &to, &progress)?; + match file.reason() { + Reason::FileError => (), + _ => restore_generation(&client, &gen, file.fileno(), file.entry(), &to, &progress)?, + } } for file in gen.files()? { if file.entry().is_dir() { |