mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
lib/open: no default mail root in split configurations
If we know the configuration is split, but there is no mail root defined, this indicates a (lack of) configuration error. Currently this can only arise in XDG configurations.
This commit is contained in:
parent
64212c7b91
commit
fad2e7540b
5 changed files with 12 additions and 2 deletions
|
@ -54,6 +54,7 @@ ffibuilder.cdef(
|
||||||
NOTMUCH_STATUS_NO_DATABASE,
|
NOTMUCH_STATUS_NO_DATABASE,
|
||||||
NOTMUCH_STATUS_DATABASE_EXISTS,
|
NOTMUCH_STATUS_DATABASE_EXISTS,
|
||||||
NOTMUCH_STATUS_BAD_QUERY_SYNTAX,
|
NOTMUCH_STATUS_BAD_QUERY_SYNTAX,
|
||||||
|
NOTMUCH_STATUS_NO_MAIL_ROOT,
|
||||||
NOTMUCH_STATUS_LAST_STATUS
|
NOTMUCH_STATUS_LAST_STATUS
|
||||||
} notmuch_status_t;
|
} notmuch_status_t;
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
|
@ -657,6 +657,7 @@ notmuch_status_t
|
||||||
_notmuch_config_load_defaults (notmuch_database_t *notmuch)
|
_notmuch_config_load_defaults (notmuch_database_t *notmuch)
|
||||||
{
|
{
|
||||||
notmuch_config_key_t key;
|
notmuch_config_key_t key;
|
||||||
|
notmuch_status_t status = NOTMUCH_STATUS_SUCCESS;
|
||||||
|
|
||||||
if (notmuch->config == NULL)
|
if (notmuch->config == NULL)
|
||||||
notmuch->config = _notmuch_string_map_create (notmuch);
|
notmuch->config = _notmuch_string_map_create (notmuch);
|
||||||
|
@ -669,11 +670,14 @@ _notmuch_config_load_defaults (notmuch_database_t *notmuch)
|
||||||
|
|
||||||
val = _notmuch_string_map_get (notmuch->config, key_string);
|
val = _notmuch_string_map_get (notmuch->config, key_string);
|
||||||
if (! val) {
|
if (! val) {
|
||||||
|
if (key == NOTMUCH_CONFIG_MAIL_ROOT && (notmuch->params & NOTMUCH_PARAM_SPLIT))
|
||||||
|
status = NOTMUCH_STATUS_NO_MAIL_ROOT;
|
||||||
|
|
||||||
_notmuch_string_map_set (notmuch->config, key_string, _notmuch_config_default (notmuch,
|
_notmuch_string_map_set (notmuch->config, key_string, _notmuch_config_default (notmuch,
|
||||||
key));
|
key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NOTMUCH_STATUS_SUCCESS;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
|
|
@ -311,6 +311,8 @@ notmuch_status_to_string (notmuch_status_t status)
|
||||||
return "Database exists, not recreated";
|
return "Database exists, not recreated";
|
||||||
case NOTMUCH_STATUS_BAD_QUERY_SYNTAX:
|
case NOTMUCH_STATUS_BAD_QUERY_SYNTAX:
|
||||||
return "Syntax error in query";
|
return "Syntax error in query";
|
||||||
|
case NOTMUCH_STATUS_NO_MAIL_ROOT:
|
||||||
|
return "No mail root found";
|
||||||
default:
|
default:
|
||||||
case NOTMUCH_STATUS_LAST_STATUS:
|
case NOTMUCH_STATUS_LAST_STATUS:
|
||||||
return "Unknown error status value";
|
return "Unknown error status value";
|
||||||
|
|
|
@ -224,6 +224,10 @@ typedef enum {
|
||||||
* Syntax error in query
|
* Syntax error in query
|
||||||
*/
|
*/
|
||||||
NOTMUCH_STATUS_BAD_QUERY_SYNTAX,
|
NOTMUCH_STATUS_BAD_QUERY_SYNTAX,
|
||||||
|
/**
|
||||||
|
* No mail root could be deduced from parameters and environment
|
||||||
|
*/
|
||||||
|
NOTMUCH_STATUS_NO_MAIL_ROOT,
|
||||||
/**
|
/**
|
||||||
* Not an actual status value. Just a way to find out how many
|
* Not an actual status value. Just a way to find out how many
|
||||||
* valid status values there are.
|
* valid status values there are.
|
||||||
|
|
|
@ -1022,7 +1022,6 @@ notmuch_dir_sanitize < OUTPUT > OUTPUT.clean
|
||||||
test_expect_equal_file EXPECTED.common OUTPUT.clean
|
test_expect_equal_file EXPECTED.common OUTPUT.clean
|
||||||
|
|
||||||
test_begin_subtest "open/error: config=empty with no mail root in db (xdg)"
|
test_begin_subtest "open/error: config=empty with no mail root in db (xdg)"
|
||||||
test_subtest_known_broken
|
|
||||||
old_NOTMUCH_CONFIG=${NOTMUCH_CONFIG}
|
old_NOTMUCH_CONFIG=${NOTMUCH_CONFIG}
|
||||||
unset NOTMUCH_CONFIG
|
unset NOTMUCH_CONFIG
|
||||||
backup_database
|
backup_database
|
||||||
|
|
Loading…
Reference in a new issue