Skip to content

Commit

Permalink
Merge pull request #948 from aschnell/master
Browse files Browse the repository at this point in the history
- support creating empty snapshots
  • Loading branch information
aschnell authored Oct 25, 2024
2 parents cc499a2 + ea4895c commit 078f70c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
9 changes: 7 additions & 2 deletions client/snapper/cmd-create.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ namespace snapper
{ _("--command <command>"), _("Run command and create pre and post snapshots.")},
{ _("--read-only"), _("Create read-only snapshot.") },
{ _("--read-write"), _("Create read-write snapshot.") },
{ _("--from <number>"), _("Create a snapshot from the specified snapshot.") }
{ _("--from <number>"), _("Create a snapshot from the specified snapshot.") },
{ _("--empty"), _("Create an empty snapshot.") }
});
}

Expand All @@ -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);
Expand Down Expand Up @@ -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.")));
Expand Down
11 changes: 9 additions & 2 deletions doc/snapper.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<refentry id='snapper8' xmlns:xlink="http://www.w3.org/1999/xlink">

<refentryinfo>
<date>2024-04-18</date>
<date>2024-10-24</date>
</refentryinfo>

<refmeta>
<refentrytitle>snapper</refentrytitle>
<manvolnum>8</manvolnum>
<refmiscinfo class='date'>2024-04-18</refmiscinfo>
<refmiscinfo class='date'>2024-10-24</refmiscinfo>
<refmiscinfo class='version'>@VERSION@</refmiscinfo>
<refmiscinfo class='manual'>Filesystem Snapshot Management</refmiscinfo>
</refmeta>
Expand Down Expand Up @@ -550,6 +550,13 @@
provided number instead of snapshot 0.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--empty</option></term>
<listitem>
<para>Create an empty snapshot. Only supported on
btrfs and with --no-dbus.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
Expand Down
5 changes: 5 additions & 0 deletions package/snapper.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Fri Oct 25 08:48:46 CEST 2024 - [email protected]

- support creating empty snapshots (gh#openSUSE/snapper#944)

-------------------------------------------------------------------
Fri Oct 11 10:34:42 CEST 2024 - [email protected]

Expand Down
2 changes: 1 addition & 1 deletion snapper/Snapshot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down

0 comments on commit 078f70c

Please sign in to comment.