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.
This commit is contained in:
Carl Worth 2010-11-11 00:26:04 -08:00
parent 4b6063397f
commit 81cbaafc0f

View file

@ -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;
}