| Age | Commit message (Collapse) | Author |
|
This is mainly targetted at notmuch-config.c, or similar applications
that don't necessarily need both a configuration file and a database
to exist.
|
|
Although this increases code duplication, it also increases
flexibility in handling various combinations of missing config file
and missing database.
|
|
|
|
_trial_open can't know if the PATH_ERROR return value will cause the
error message to be returned from the library, so it's up the caller
to clean up if not.
|
|
Like the hook directory, we primarily need a way to communicate this
directory between various components, but we may as well let the user
configure it.
Most of the diff is generalizing choose_hook_dir to work for both
backup and hook directories.
|
|
Choose sibling directory of xapian database, as .notmuch may not
exist.
libgen.h is already used in debugger.c, so it is not a new dependency
/ potential portability problem.
|
|
This promotes _choose_xapian_path from static to extern linkage in
order to share between open.cc and database.cc.
|
|
This changes some error reporting, either intentionally by reporting
the highest level missing directory, or by side effect from looking in
XDG locations when given null database location.
|
|
The main functionality will be tested when notmuch-new is converted to
support split configuration. Here only the somewhat odd case of split
mail root which is actually symlinked to the database path is tested.
|
|
Introduce a new configuration value for the mail root, and use it to
locate mail messages in preference to the database.path (which
previously implied the mail messages were also in this location.
Initially only a subset of the CLI is tested in a split
configuration. Further changes will be needed for the remainder of the
CLI to work in split configurations.
|
|
This is a bit heavyweight for now, but it will make more sense when we
check multiple locations for the Xapian database.
|
|
This avoids reading the configuration file twice.
|
|
The idea is to allow reuse in n_d_create_with_config. This is
primarily code movement, with some changes in error messages to reduce
the number of input parameters.
|
|
Make checks more uniform between creating new databases and opening
existing ones.
|
|
This is slightly more tidy, but more importantly it allows for re-use
of this code in n_d_create_with_config. That re-use will be crucial
when we no longer call n_d_open_with_config from
n_d_create_with_config.
|
|
This removes duplication between the struct element and the
configuration string_map entry. Create a simple wrapper for setting
the database path that makes sure the trailing / is stripped.
|
|
This gives more flexibility in restructuring the database opening
code.
|
|
The additional code is trivial, but making sure we get the priority of
various options correct takes a few tests.
|
|
In the future Xapian will apparently support this more conveniently
for the cases other than READ_ONLY => READ_ONLY
Conceptually this function seems to fit better in lib/open.cc;
database.cc is still large enough that moving the function makes
sense.
|
|
This will allow re-opening in a different mode (read/write
vs. read-only) with current Xapian API. It will also prove useful when
updating the compact functions to support more flexible database
location.
|
|
Include the (currently unused) mode argument which will specify which
mode to re-open the database in. Functionality and docs to be
finalized in a followup commit.
|
|
This fixes a small-to-medium (depending on size of config file) memory
leak.
|
|
This fixes a few small memory leaks.
|
|
This fixes a small memory leak.
|
|
This better matches the memory allocation semantics in
notmuch_database_open_with_config.
|
|
This is the result of running
$ uncrustify --replace --config ../devel/uncrustify.cfg *.c *.h *.cc
in the lib directory
|
|
notmuch 0.31.4 release
|
|
Based on a patch from Michael J Gruber [1]. As of glib 2.67 (more
specifically [2]), including "gmime-extra.h" inside an extern "C"
block causes build failures, because glib is using C++ features.
Observing that "gmime-extra.h" is no longer needed in
notmuch-private.h, which can simply delete that include, but
we have to correspondingly move the includes which might include
it (in particular crypto.h) out of the extern "C" block also.
This seems less fragile than only moving gmime-extra, and relying on
preprocessor sentinels to keep the deeper includes from happening.
Move to the include to the outside of the extern block.
[1]: id:aee618a3d41f7889a7449aa16893e992325a909a.1613055071.git.git@grubix.eu
[2]: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1715
|
|
This would have caught bugs like the one corrected in the previous commit.
|
|
With the current unused macro in lib/notmuch-private.h this seems
harmless, but is misleading, since the parameter is in fact used.
|
|
Many public status values have been added without being copied to the
list of private status values.
|
|
This is a simple two step path search. Most error checking is
deferred until running the hooks.
|
|
The hook directory configuration needs to be kept in synch with the
other configuration information, so add scaffolding to support this at
database opening time.
|
|
This takes a config path parameter, and can use that to decide the
new database location.
|
|
It is desirable to distinguish between attempting to create a database
that already exists, and more fatal errors like permission problems.
|
|
This will help share code with n_d_open_with_config.
|
|
This will allow client code to provide more meaningful diagnostics. In
particular it will enable "notmuch new" to continue suggsting the user
run "notmuch setup" to create a config after "notmuch new" is
transitioned to the new configuration framework.
|
|
The plan is to share code with a new database creation function that
has a similar API to n_d_open_with_config.
|
|
This will be needed by (at least) the conversion of notmuch-new.c to
the new config framework
|
|
The "back end" function takes an open notmuch database, which should
know its own path (i.e. the path needs to be cached in the
configuration data).
|
|
This is a simple convenience routine to cache a configuration value
without writing it to the database.
|
|
Booleans have no out of band values, so return a status for errors.
|
|
This is relatively cheap, and makes it easier to transform existing
code which uses arrays of pointers to store configuration lists.
|
|
This is intended to avoid duplicating the string splitting and
traversal code for all clients of the config API.
|
|
This emulates the behaviour of notmuch_config_open defined in the CLI,
in that it fills in default values if they are not otherwise defined.
|
|
By using an enum we can have better error detection than copy pasting
key strings around.
The question of what layer this belongs in is a bit
tricky. Historically most of the keys are defined by the CLI. On the
other hand features like excludes are supported in the
library/bindings, and it makes sense to configure them from the
library as well.
The somewhat long prefix for notmuch_config_t is to avoid collisions
with the existing usage in notmuch-client.h.
|
|
Fill in the remainder of the documented functionality for
n_d_open_with_config with respect to config file location. Similar
searching default locations of the database file still needs to be
added.
|
|
Initially document the intended API and copy the code from
notmuch_database_open_verbose. Most of the documented functionality is
not there yet.
|
|
The main goal is to allow configuration information to be temporarily
overridden by a separate config file. That will require further
changes not in this commit.
The performance impact is unclear, and will depend on the balance
between number of queries and number of distinct metadata items read
on the first call to n_d_get_config.
|
|
This will be used (and tested) by the configuration caching code to be
added in the next commit.
|