aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch.c
diff options
context:
space:
mode:
authorGravatar Carl Worth <cworth@cworth.org>2009-10-26 22:25:45 -0700
committerGravatar Carl Worth <cworth@cworth.org>2009-10-26 22:53:39 -0700
commit31db02a8c1afdb025da6e0e7e62630ffffc69eb7 (patch)
tree6d2b3ccd0aa7db1bc52ad46a35adb67c5cfe056c /notmuch.c
parent9c4efa8487d292268d9ae6a089b1063c6e82e6e4 (diff)
notmuch restore: Fix to remove all tags before adding tags.
This means that the restore operation will now properly pick up the removal of tags indicated by the tag just not being present in the dump file. We added a few new public functions in order to support this: notmuch_message_freeze notmuch_message_remove_all_tags notmuch_message_thaw
Diffstat (limited to 'notmuch.c')
-rw-r--r--notmuch.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/notmuch.c b/notmuch.c
index 3b0182a9..d716bce3 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -287,6 +287,7 @@ add_files_recursive (notmuch_database_t *notmuch,
case NOTMUCH_STATUS_FILE_ERROR:
case NOTMUCH_STATUS_NULL_POINTER:
case NOTMUCH_STATUS_TAG_TOO_LONG:
+ case NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW:
case NOTMUCH_STATUS_LAST_STATUS:
INTERNAL_ERROR ("add_message returned unexpected value: %d", status);
goto DONE;
@@ -854,6 +855,10 @@ restore_command (int argc, char *argv[])
goto NEXT_LINE;
}
+ notmuch_message_freeze (message);
+
+ notmuch_message_remove_all_tags (message);
+
next = tags;
while (next) {
tag = strsep (&next, " ");
@@ -869,6 +874,7 @@ restore_command (int argc, char *argv[])
}
}
+ notmuch_message_thaw (message);
notmuch_message_destroy (message);
}
NEXT_LINE: