]> git.notmuchmail.org Git - notmuch/commitdiff
lib/open: do not consider .notmuch alone as an existing database.
authorDavid Bremner <david@tethera.net>
Sat, 25 Dec 2021 21:22:56 +0000 (17:22 -0400)
committerDavid Bremner <david@tethera.net>
Wed, 29 Dec 2021 18:11:21 +0000 (14:11 -0400)
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.

lib/open.cc
test/T055-path-config.sh

index a942383b84b8cda800ae8006034555e267d11119..4dd62a9f25caafc5baec4803ee883e8bca333018 100644 (file)
@@ -662,16 +662,12 @@ notmuch_database_create_with_config (const char *database_path,
 
        err = mkdir (notmuch_path, 0755);
        if (err) {
-           if (errno == EEXIST) {
-               status = NOTMUCH_STATUS_DATABASE_EXISTS;
-               talloc_free (notmuch);
-               notmuch = NULL;
-           } else {
+           if (errno != EEXIST) {
                IGNORE_RESULT (asprintf (&message, "Error: Cannot create directory %s: %s.\n",
                                         notmuch_path, strerror (errno)));
                status = NOTMUCH_STATUS_FILE_ERROR;
+               goto DONE;
            }
-           goto DONE;
        }
     }
 
index b6858d42e4287086ecf41192debc96cfb00fda81..b910e28ee6257ac8734bcde968257fb7ddb471f9 100755 (executable)
@@ -322,7 +322,6 @@ EOF
        *)
           backup_database
           test_begin_subtest ".notmuch without xapian/ handled gracefully ($config)"
-          test_subtest_known_broken
           rm -r $XAPIAN_PATH
           test_expect_success "notmuch new"
           restore_database