lib: Fix endless upgrade problem
authorAustin Clements <amdragon@mit.edu>
Mon, 1 Sep 2014 22:49:07 +0000 (18:49 -0400)
committerDavid Bremner <david@tethera.net>
Tue, 2 Sep 2014 06:06:51 +0000 (23:06 -0700)
48db8c8 introduced a disagreement between when
notmuch_database_needs_upgrade returned TRUE and when
notmuch_database_upgrade actually performed an upgrade.  As a result,
if a database had a version less than 3, but no new features were
required, notmuch new would call notmuch_database_upgrade to perform
an upgrade, but notmuch_database_upgrade would return immediately
without updating the database version.  Hence, the next notmuch new
would do the same, and so on.

Fix this by ensuring that the upgrade-required logic is identical
between the two.

lib/database.cc

index 511618893d50ac7ba5c5af692e98151138a84824..a3a7cd3090d838eb43af18bb479aa284e274e787 100644 (file)
@@ -1222,7 +1222,7 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
     target_features = notmuch->features | NOTMUCH_FEATURES_CURRENT;
     new_features = NOTMUCH_FEATURES_CURRENT & ~notmuch->features;
 
-    if (! new_features)
+    if (! notmuch_database_needs_upgrade (notmuch))
        return NOTMUCH_STATUS_SUCCESS;
 
     if (progress_notify) {