From: Cheng-Ling Lai Date: Mon, 16 Feb 2026 07:59:27 +0000 (+0800) Subject: Rearrange precondition checks for snapshot restore X-Git-Tag: v0.13.1~18^2~1 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=1c02e683ed17b83ed64f12e28a387b6b541d3d5c;p=thirdparty%2Fsnapper.git Rearrange precondition checks for snapshot restore --- diff --git a/client/snbk/TheBigThing.cc b/client/snbk/TheBigThing.cc index 812cf807..4d20e5c6 100644 --- a/client/snbk/TheBigThing.cc +++ b/client/snbk/TheBigThing.cc @@ -302,12 +302,12 @@ namespace snapper if (!quiet) cout << sformat(_("Restoring snapshot %d."), num) << '\n'; - if (target_state != TargetState::VALID) - SN_THROW(Exception(_("Snapshot not on target."))); - if (source_state != SourceState::MISSING) SN_THROW(Exception(_("Snapshot already on source."))); + if (target_state != TargetState::VALID) + SN_THROW(Exception(_("Snapshot not on target."))); + // Copy the snapshot from the target to the source copy(backup_config, the_big_things, make_copy_specs(backup_config, the_big_things, CopyMode::TARGET_TO_SOURCE));