From 31db02a8c1afdb025da6e0e7e62630ffffc69eb7 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 26 Oct 2009 22:25:45 -0700 Subject: 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 --- notmuch.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'notmuch.c') 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: -- cgit v1.2.3