From: Arvin Schnell Date: Fri, 25 Oct 2024 06:50:55 +0000 (+0200) Subject: - support creating empty snapshots X-Git-Tag: v0.12.0~20^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F948%2Fhead;p=thirdparty%2Fsnapper.git - support creating empty snapshots --- diff --git a/client/snapper/cmd-create.cc b/client/snapper/cmd-create.cc index 4abdb63a..75f67436 100644 --- a/client/snapper/cmd-create.cc +++ b/client/snapper/cmd-create.cc @@ -56,7 +56,8 @@ namespace snapper { _("--command "), _("Run command and create pre and post snapshots.")}, { _("--read-only"), _("Create read-only snapshot.") }, { _("--read-write"), _("Create read-write snapshot.") }, - { _("--from "), _("Create a snapshot from the specified snapshot.") } + { _("--from "), _("Create a snapshot from the specified snapshot.") }, + { _("--empty"), _("Create an empty snapshot.") } }); } @@ -83,7 +84,8 @@ namespace snapper Option("command", required_argument), Option("read-only", no_argument), Option("read-write", no_argument), - Option("from", required_argument) + Option("from", required_argument), + Option("empty", no_argument) }; ParsedOpts opts = get_opts.parse("create", options); @@ -140,6 +142,9 @@ namespace snapper if ((opt = opts.find("from")) != opts.end()) parent = snapshots.findNum(opt->second); + if ((opt = opts.find("empty")) != opts.end()) + scd.empty = true; + if (type == CreateType::POST && snapshot1 == snapshots.end()) { SN_THROW(OptionsException(_("Missing or invalid pre-number."))); diff --git a/doc/snapper.xml.in b/doc/snapper.xml.in index 91e5a8cb..14ced521 100644 --- a/doc/snapper.xml.in +++ b/doc/snapper.xml.in @@ -2,13 +2,13 @@ - 2024-04-18 + 2024-10-24 snapper 8 - 2024-04-18 + 2024-10-24 @VERSION@ Filesystem Snapshot Management @@ -550,6 +550,13 @@ provided number instead of snapshot 0. + + + + Create an empty snapshot. Only supported on + btrfs and with --no-dbus. + + diff --git a/package/snapper.changes b/package/snapper.changes index dc21f854..0adb8faa 100644 --- a/package/snapper.changes +++ b/package/snapper.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Oct 25 08:48:46 CEST 2024 - aschnell@suse.com + +- support creating empty snapshots (gh#openSUSE/snapper#944) + ------------------------------------------------------------------- Fri Oct 11 10:34:42 CEST 2024 - aschnell@suse.com diff --git a/snapper/Snapshot.cc b/snapper/Snapshot.cc index 809685f0..200c128e 100644 --- a/snapper/Snapshot.cc +++ b/snapper/Snapshot.cc @@ -698,7 +698,7 @@ namespace snapper snapshot.cleanup = scd.cleanup; snapshot.userdata = scd.userdata; - return createHelper(snapshot, parent, false, report); + return createHelper(snapshot, parent, scd.empty, report); }