]> git.notmuchmail.org Git - notmuch/commitdiff
Merge branch from fixing up bugs after bisecting.
authorCarl Worth <cworth@cworth.org>
Thu, 22 Oct 2009 06:23:32 +0000 (23:23 -0700)
committerCarl Worth <cworth@cworth.org>
Thu, 22 Oct 2009 06:23:44 +0000 (23:23 -0700)
I'm glad that when I implemented "notmuch restore" I went through the
extra effort to take the code I had written in one sitting into over a
dozen commits. Sure enough, I hadn't tested well enough and had
totally broken "notmuch setup", (segfaults and bogus thread_id
values).

With the little commits I had made, git bisect saved the day, and I
went back to make the fixes right on top of the commits that
introduced the bugs. So now we octopus merge those in.

1  2  3 
database.cc
message.cc

diff --cc database.cc
index 5049b47e9ef593d44b586bc67d37064f79dc0a84,00b03731206289b171736dd8f9c4044a67f8f0a8,77b2eff22973073aa511c2d0c0baa31d20190e31..6d62109e73c11e758987c5203839e2ef91aa8291
@@@@ -133,21 -111,42 -111,44 +133,44 @@@@ find_message_by_docid (Xapian::Databas
       return db->get_document (docid);
   }
   
 - Xapian::Document
 - find_message_by_message_id (Xapian::Database *db, const char *message_id)
 - {
 -     Xapian::PostingIterator i, end;
 - 
 -     find_messages_by_term (db, "msgid", message_id, &i, &end);
 - 
 -     if (i != end)
 -      return find_message_by_docid (db, *i);
 -     else
 -      return Xapian::Document ();
 - }
 - 
+  static void
+  insert_thread_id (GHashTable *thread_ids, Xapian::Document doc)
+  {
+      string value_string;
+      const char *value, *id, *comma;
+  
+      value_string = doc.get_value (NOTMUCH_VALUE_THREAD);
+      value = value_string.c_str();
+      if (strlen (value)) {
+       id = value;
+       while (*id) {
+           comma = strchr (id, ',');
+           if (comma == NULL)
+               comma = id + strlen (id);
+           g_hash_table_insert (thread_ids,
+                                strndup (id, comma - id), NULL);
+           id = comma;
+           if (*id)
+               id++;
+       }
+      }
+  }
+  
 + notmuch_message_t *
 + notmuch_database_find_message (notmuch_database_t *notmuch,
 +                             const char *message_id)
 + {
 +     Xapian::PostingIterator i, end;
 + 
 +     find_messages_by_term (notmuch->xapian_db,
 +                         "msgid", message_id, &i, &end);
 + 
 +     if (i == end)
 +      return NULL;
 + 
 +     return _notmuch_message_create (notmuch, notmuch, *i);
 + }
 + 
   /* Return one or more thread_ids, (as a GPtrArray of strings), for the
    * given message based on looking into the database for any messages
    * referenced in parents, and also for any messages in the database
diff --cc message.cc
Simple merge