From 154bf7ac677c41168c5c6a982fee3f22350adfef Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sat, 19 Dec 2009 13:11:00 -0800 Subject: [PATCH] database: Store directory paths as relative, not absolute. 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 | 4 +++- lib/notmuch.h | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/database.cc b/lib/database.cc index f7f9943f..0ef59ea9 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -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 (notmuch->xapian_db); db_path = directory_db_path (path); diff --git a/lib/notmuch.h b/lib/notmuch.h index a98241de..786b8e9f 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -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 -- 2.43.0