]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- reuse code
authorArvin Schnell <aschnell@suse.de>
Thu, 18 Dec 2025 08:43:27 +0000 (09:43 +0100)
committerArvin Schnell <aschnell@suse.de>
Thu, 18 Dec 2025 08:43:27 +0000 (09:43 +0100)
client/snbk/TheBigThing.cc
client/snbk/TheBigThing.h

index 2587efac8be55515032729f5c5f13a44616c3f24..b139f97a37476f44076491cea234a15cee1d04ed 100644 (file)
@@ -136,11 +136,7 @@ namespace snapper
 
        // Copy snapshot to target.
 
-       const int proto = std::min({
-           Uname::supported_proto(),
-           the_big_things.source_btrfs_version.supported_proto(),
-           the_big_things.target_btrfs_version.supported_proto()
-       });
+       const int proto = the_big_things.proto();
 
        TheBigThings::const_iterator it1 = the_big_things.find_send_parent(*this);
 
@@ -266,11 +262,7 @@ namespace snapper
 
        // Copy snapshot to target.
 
-       const int proto = std::min({
-           Uname::supported_proto(),
-           the_big_things.source_btrfs_version.supported_proto(),
-           the_big_things.target_btrfs_version.supported_proto()
-       });
+       const int proto = the_big_things.proto();
 
        TheBigThings::const_iterator it1 = the_big_things.find_restore_parent(*this);
 
@@ -372,6 +364,17 @@ namespace snapper
     }
 
 
+    int
+    TheBigThings::proto()
+    {
+       return std::min({
+           Uname::supported_proto(),
+           source_btrfs_version.supported_proto(),
+           target_btrfs_version.supported_proto()
+       });
+    }
+
+
     bool
     operator<(const TheBigThing& lhs, const TheBigThing& rhs)
     {
index 0aa24ddec502f061cac977eea4bd50e695e66e60..140ed749ea7eb884f796ea21ecfac9977d44e460 100644 (file)
@@ -118,6 +118,8 @@ namespace snapper
        CmdBtrfsVersion source_btrfs_version;
        CmdBtrfsVersion target_btrfs_version;
 
+       int proto();
+
     private:
 
        const ProxySnapper* snapper;