mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-28 13:44:12 +01:00
lib/open: do not consider .notmuch alone as an existing database.
It makes perfect sense for users to want to pre-create .notmuch, e.g. to install hooks, so we should handle the case of a .notmuch directory without an actual xapian database more gracefully.
This commit is contained in:
parent
e43bad4883
commit
25e0f5e592
2 changed files with 2 additions and 7 deletions
|
@ -662,18 +662,14 @@ notmuch_database_create_with_config (const char *database_path,
|
||||||
|
|
||||||
err = mkdir (notmuch_path, 0755);
|
err = mkdir (notmuch_path, 0755);
|
||||||
if (err) {
|
if (err) {
|
||||||
if (errno == EEXIST) {
|
if (errno != EEXIST) {
|
||||||
status = NOTMUCH_STATUS_DATABASE_EXISTS;
|
|
||||||
talloc_free (notmuch);
|
|
||||||
notmuch = NULL;
|
|
||||||
} else {
|
|
||||||
IGNORE_RESULT (asprintf (&message, "Error: Cannot create directory %s: %s.\n",
|
IGNORE_RESULT (asprintf (&message, "Error: Cannot create directory %s: %s.\n",
|
||||||
notmuch_path, strerror (errno)));
|
notmuch_path, strerror (errno)));
|
||||||
status = NOTMUCH_STATUS_FILE_ERROR;
|
status = NOTMUCH_STATUS_FILE_ERROR;
|
||||||
}
|
|
||||||
goto DONE;
|
goto DONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! (notmuch->xapian_path = talloc_asprintf (notmuch, "%s/%s", notmuch_path, "xapian"))) {
|
if (! (notmuch->xapian_path = talloc_asprintf (notmuch, "%s/%s", notmuch_path, "xapian"))) {
|
||||||
status = NOTMUCH_STATUS_OUT_OF_MEMORY;
|
status = NOTMUCH_STATUS_OUT_OF_MEMORY;
|
||||||
|
|
|
@ -322,7 +322,6 @@ EOF
|
||||||
*)
|
*)
|
||||||
backup_database
|
backup_database
|
||||||
test_begin_subtest ".notmuch without xapian/ handled gracefully ($config)"
|
test_begin_subtest ".notmuch without xapian/ handled gracefully ($config)"
|
||||||
test_subtest_known_broken
|
|
||||||
rm -r $XAPIAN_PATH
|
rm -r $XAPIAN_PATH
|
||||||
test_expect_success "notmuch new"
|
test_expect_success "notmuch new"
|
||||||
restore_database
|
restore_database
|
||||||
|
|
Loading…
Reference in a new issue