Skip to content

Commit 078f70c

Browse files
authored
Merge pull request #948 from aschnell/master
- support creating empty snapshots
2 parents cc499a2 + ea4895c commit 078f70c

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

client/snapper/cmd-create.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ namespace snapper
5656
{ _("--command <command>"), _("Run command and create pre and post snapshots.")},
5757
{ _("--read-only"), _("Create read-only snapshot.") },
5858
{ _("--read-write"), _("Create read-write snapshot.") },
59-
{ _("--from <number>"), _("Create a snapshot from the specified snapshot.") }
59+
{ _("--from <number>"), _("Create a snapshot from the specified snapshot.") },
60+
{ _("--empty"), _("Create an empty snapshot.") }
6061
});
6162
}
6263

@@ -83,7 +84,8 @@ namespace snapper
8384
Option("command", required_argument),
8485
Option("read-only", no_argument),
8586
Option("read-write", no_argument),
86-
Option("from", required_argument)
87+
Option("from", required_argument),
88+
Option("empty", no_argument)
8789
};
8890

8991
ParsedOpts opts = get_opts.parse("create", options);
@@ -140,6 +142,9 @@ namespace snapper
140142
if ((opt = opts.find("from")) != opts.end())
141143
parent = snapshots.findNum(opt->second);
142144

145+
if ((opt = opts.find("empty")) != opts.end())
146+
scd.empty = true;
147+
143148
if (type == CreateType::POST && snapshot1 == snapshots.end())
144149
{
145150
SN_THROW(OptionsException(_("Missing or invalid pre-number.")));

doc/snapper.xml.in

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
<refentry id='snapper8' xmlns:xlink="http://www.w3.org/1999/xlink">
33

44
<refentryinfo>
5-
<date>2024-04-18</date>
5+
<date>2024-10-24</date>
66
</refentryinfo>
77

88
<refmeta>
99
<refentrytitle>snapper</refentrytitle>
1010
<manvolnum>8</manvolnum>
11-
<refmiscinfo class='date'>2024-04-18</refmiscinfo>
11+
<refmiscinfo class='date'>2024-10-24</refmiscinfo>
1212
<refmiscinfo class='version'>@VERSION@</refmiscinfo>
1313
<refmiscinfo class='manual'>Filesystem Snapshot Management</refmiscinfo>
1414
</refmeta>
@@ -550,6 +550,13 @@
550550
provided number instead of snapshot 0.</para>
551551
</listitem>
552552
</varlistentry>
553+
<varlistentry>
554+
<term><option>--empty</option></term>
555+
<listitem>
556+
<para>Create an empty snapshot. Only supported on
557+
btrfs and with --no-dbus.</para>
558+
</listitem>
559+
</varlistentry>
553560
</variablelist>
554561
</listitem>
555562
</varlistentry>

package/snapper.changes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
-------------------------------------------------------------------
2+
Fri Oct 25 08:48:46 CEST 2024 - [email protected]
3+
4+
- support creating empty snapshots (gh#openSUSE/snapper#944)
5+
16
-------------------------------------------------------------------
27
Fri Oct 11 10:34:42 CEST 2024 - [email protected]
38

snapper/Snapshot.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ namespace snapper
698698
snapshot.cleanup = scd.cleanup;
699699
snapshot.userdata = scd.userdata;
700700

701-
return createHelper(snapshot, parent, false, report);
701+
return createHelper(snapshot, parent, scd.empty, report);
702702
}
703703

704704

0 commit comments

Comments
 (0)