]> git.notmuchmail.org Git - notmuch/commitdiff
database: Store directory paths as relative, not absolute.
authorCarl Worth <cworth@cworth.org>
Sat, 19 Dec 2009 21:11:00 +0000 (13:11 -0800)
committerCarl Worth <cworth@cworth.org>
Wed, 6 Jan 2010 18:32:05 +0000 (10:32 -0800)
We were already storing relative mail filenames, so this is consistent
with that. Additionally, it means that directory documents remain
valid even if the database is relocated within its containing
filesystem.

lib/database.cc
lib/notmuch.h

index f7f9943f8a5ac6e03e90c40640b9198d95a2b8cf..0ef59ea9e40564a15dee60636cfa82af9a78131e 100644 (file)
@@ -86,7 +86,7 @@ typedef struct {
  *
  * The directory document is indexed with a single prefixed term:
  *
- *     directory:      The directory path (an absolute path)
+ *     directory:      The directory path (relative to the database path)
  *
  * and has a single value:
  *
@@ -639,6 +639,8 @@ notmuch_database_set_directory_mtime (notmuch_database_t *notmuch,
        return NOTMUCH_STATUS_READONLY_DATABASE;
     }
 
+    path = _notmuch_database_relative_path (notmuch, path);
+
     db = static_cast <Xapian::WritableDatabase *> (notmuch->xapian_db);
     db_path = directory_db_path (path);
 
index a98241de8878b7542c5e09a3805c4578ee671314..786b8e9f034d4ec73352687b13699319208a9397 100644 (file)
@@ -179,6 +179,11 @@ const char *
 notmuch_database_get_path (notmuch_database_t *database);
 
 /* Store an mtime within the database for 'path'.
+ *
+ * Here,'path' should be the path of a directory relative to the path
+ * of 'database' (see notmuch_database_get_path), or else should be an
+ * absolute path with initial components that match the path of
+ * 'database'.
  *
  * The intention is for the caller to use the mtime to allow efficient
  * identification of new messages to be added to the database. The