From: Carl Worth Date: Thu, 11 Nov 2010 08:26:04 +0000 (-0800) Subject: Fix notmuch_message_tags_to_maildir_flags to effect rename immediately X-Git-Tag: 0.5~34 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=81cbaafc0f64dcc77933d06e0d2b22ee38eefd88;p=notmuch.git Fix notmuch_message_tags_to_maildir_flags to effect rename immediately We have tests to ensure that when the notmuch library renames a file that that rename takes place immediately in the database, (without requiring something like "notmuch new" to notice the change). This was working when the code was first added, but recently broke in the reworking of the maildir-synchronization interface since the tags_to_maildir_flags function can no longer assume that it is being called as part of _notmuch_message_sync. Fortunately, the fix is as simple as adding an explicit call to _notmuch_message_sync. --- diff --git a/lib/message.cc b/lib/message.cc index ee52672a..39036ecc 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -998,14 +998,19 @@ notmuch_message_tags_to_maildir_flags (notmuch_message_t *message) strcpy (filename_new+(p-filename)+3, flags); if (strcmp (filename, filename_new) != 0) { + notmuch_status_t status; + ret = rename (filename, filename_new); if (ret == -1) { perror (talloc_asprintf (message, "rename of %s to %s failed", filename, filename_new)); exit (1); } - return _notmuch_message_rename (message, filename_new); - /* _notmuch_message_sync is our caller. Do not call it here. */ + status = _notmuch_message_rename (message, filename_new); + + _notmuch_message_sync (message); + + return status; } return NOTMUCH_STATUS_SUCCESS; }