]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- fixed comparing with current system
authorArvin Schnell <aschnell@suse.de>
Fri, 4 Feb 2011 10:04:00 +0000 (11:04 +0100)
committerArvin Schnell <aschnell@suse.de>
Fri, 4 Feb 2011 10:04:00 +0000 (11:04 +0100)
snapper/File.cc
snapper/Snapshot.h

index 1e97918423f5b6b9041f80075f976d123013e361..847405415a822e78ed2af4324b8949b2bf874c32 100644 (file)
@@ -78,6 +78,8 @@ namespace snapper
     {
        y2mil("num1:" << getSnapshot1()->getNum() << " num2:" << getSnapshot2()->getNum());
 
+       assert(!getSnapshot1()->isCurrent() && !getSnapshot2()->isCurrent());
+
        entries.clear();
 
        string input = getSnapshot2()->baseDir() + "/filelist-" +
@@ -118,6 +120,8 @@ namespace snapper
     {
        y2mil("num1:" << getSnapshot1()->getNum() << " num2:" << getSnapshot2()->getNum());
 
+       assert(!getSnapshot1()->isCurrent() && !getSnapshot2()->isCurrent());
+
        string output = getSnapshot2()->baseDir() + "/filelist-" +
            decString(getSnapshot1()->getNum()) + ".txt";
 
@@ -157,10 +161,17 @@ namespace snapper
        if (initialized)
            return;
 
-       if (!load())
+       if (getSnapshot1()->isCurrent() || getSnapshot2()->isCurrent())
        {
            create();
-           save();
+       }
+       else
+       {
+           if (!load())
+           {
+               create();
+               save();
+           }
        }
 
        initialized = true;
index 9891acb39c0504a4cff26ca8846605a866ec2664..b3943d82dd8d3f42d38cd428cdab34b75fd395d3 100644 (file)
@@ -48,6 +48,7 @@ namespace snapper
        SnapshotType getType() const { return type; }
 
        unsigned int getNum() const { return num; }
+       bool isCurrent() const { return num == 0; }
 
        string getDate() const { return date; }