lib: fix return value for n_m_reindex

Also update the documentation for the behaviour of n_m_get_thread_id
that this fix relies on.
This commit is contained in:
David Bremner 2020-07-08 21:17:09 -03:00
parent a0c83e1fac
commit 765ca7bc08
3 changed files with 6 additions and 5 deletions

View file

@ -2205,8 +2205,10 @@ notmuch_message_reindex (notmuch_message_t *message,
/* Save in case we need to delete message */ /* Save in case we need to delete message */
orig_thread_id = notmuch_message_get_thread_id (message); orig_thread_id = notmuch_message_get_thread_id (message);
if (! orig_thread_id) { if (! orig_thread_id) {
/* XXX TODO: make up new error return? */ /* the following is correct as long as there is only one reason
INTERNAL_ERROR ("message without thread-id"); n_m_get_thread_id returns NULL
*/
return NOTMUCH_STATUS_XAPIAN_EXCEPTION;
} }
/* strdup it because the metadata may be invalidated */ /* strdup it because the metadata may be invalidated */

View file

@ -1378,8 +1378,8 @@ notmuch_message_get_message_id (notmuch_message_t *message);
* notmuch_message_destroy on 'message' or until a query from which it * notmuch_message_destroy on 'message' or until a query from which it
* derived is destroyed). * derived is destroyed).
* *
* This function will not return NULL since Notmuch ensures that every * This function will return NULL if triggers an unhandled Xapian
* message belongs to a single thread. * exception.
*/ */
const char * const char *
notmuch_message_get_thread_id (notmuch_message_t *message); notmuch_message_get_thread_id (notmuch_message_t *message);

View file

@ -662,7 +662,6 @@ EOF
test_expect_equal_file EXPECTED OUTPUT test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "Handle reindexing message with closed db" test_begin_subtest "Handle reindexing message with closed db"
test_subtest_known_broken
cat c_head2 - c_tail <<'EOF' | test_C ${MAIL_DIR} cat c_head2 - c_tail <<'EOF' | test_C ${MAIL_DIR}
{ {
notmuch_status_t status; notmuch_status_t status;