From: Hrotkó Gábor Date: Tue, 10 Dec 2019 11:50:00 +0000 (+0100) Subject: take specified snapshot number into accout X-Git-Tag: v0.8.8~2^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=47336682518cb36ee5ffccfe3fe499536d53aae5;p=thirdparty%2Fsnapper.git take specified snapshot number into accout --- diff --git a/client/snapper.cc b/client/snapper.cc index b976ea63..390d4631 100644 --- a/client/snapper.cc +++ b/client/snapper.cc @@ -1067,10 +1067,6 @@ command_rollback(cli::GlobalOptions* global_options, ProxySnappers* snappers, Pr if (previous_default != snapshots.end() && scd1.description == default_description) scd1.description += sformat(" of #%d", previous_default->getNum()); - ProxySnapshots::const_iterator active = snapshots.getActive(); - if (active != snapshots.end() && scd2.description == default_description) - scd2.description += sformat(" of #%d", active->getNum()); - ProxySnapshots::const_iterator snapshot1 = snapshots.end(); ProxySnapshots::const_iterator snapshot2 = snapshots.end(); @@ -1088,6 +1084,10 @@ command_rollback(cli::GlobalOptions* global_options, ProxySnappers* snappers, Pr if (!global_options->quiet()) cout << _("Creating read-write snapshot of current subvolume.") << flush; + ProxySnapshots::const_iterator active = snapshots.getActive(); + if (active != snapshots.end() && scd2.description == default_description) + scd2.description += sformat(" of #%d", active->getNum()); + scd2.read_only = false; snapshot2 = snapper->createSingleSnapshot(snapshots.getCurrent(), scd2); @@ -1109,6 +1109,9 @@ command_rollback(cli::GlobalOptions* global_options, ProxySnappers* snappers, Pr if (!global_options->quiet()) cout << sformat(_("Creating read-write snapshot of snapshot %d."), tmp->getNum()) << flush; + if (tmp != snapshots.end() && scd2.description == default_description) + scd2.description += sformat(" of #%d", tmp->getNum()); + scd2.read_only = false; snapshot2 = snapper->createSingleSnapshot(tmp, scd2);