]> git.cworth.org Git - notmuch/commitdiff
Merge tag 'debian/0.32.3-1'
authorDavid Bremner <david@tethera.net>
Thu, 19 Aug 2021 04:46:42 +0000 (21:46 -0700)
committerDavid Bremner <david@tethera.net>
Thu, 19 Aug 2021 04:46:42 +0000 (21:46 -0700)
notmuch release 0.32.3-1 for unstable (sid) [dgit]

[dgit distro=debian no-split --quilt=linear]

1  2 
NEWS
lib/notmuch.h
lib/open.cc
notmuch-config.c
test/T030-config.sh
test/T055-path-config.sh

diff --combined NEWS
index 3e776009054758bd14408ea9f93f632f79f9b93b,b826d2801e3d1c843fee41ec41f56091ea4846b3..1c6246db083c1f82599b639f4851b455e75d48c5
--- 1/NEWS
--- 2/NEWS
+++ b/NEWS
@@@ -1,20 -1,23 +1,40 @@@
 +Notmuch 0.33 (UNRELEASED)
 +=========================
 +
 +Emacs
 +-----
 +
 +`notmuch` no longer sets `mail-user-agent` on load. To restore the
 +previous behaviour of using notmuch to send mail by default, customize
 +`mail-user-agent` to `notmuch-user-agent`.
 +
 +`notmuch-company` now works in `org-msg`.
 +
 +Vim
 +---
 +
 +Respect excluded tags when showing a thread.
 +
+ Notmuch 0.32.3 (2021-08-17)
+ ===========================
+ Library
+ -------
+ Restore location of database via `MAILDIR` environment variable, which
+ was broken in 0.32.
+ Bump libnotmuch minor version to match the documentation in
+ `notmuch.h`.
+ Correct documentation for deprecated database opening functions to
+ point out that they (still) do not load configuration information.
+ CLI
+ ---
+ Restore "notmuch config get built_with.*", which was broken in 0.32.
  Notmuch 0.32.2 (2021-06-27)
  ===========================
  
@@@ -68,10 -71,6 +88,10 @@@ Emac
  Restore the dynamically bound variables `tag-changes` and `query` in
  in `notmuch-before-tag-hook` and `notmuch-after-tag-hook`.
  
 +Add `notmuch-jump-key` face to fontify keys in `notmuch-jump` and
 +related functions.  To ensure backward compatibility, the new face
 +inherits from `minibuffer-prompt`.
 +
  Notmuch 0.32 (2021-05-02)
  =========================
  
diff --combined lib/notmuch.h
index 3b28bea343bc9c329fc00ea3972d671a0cecde9a,15390610789f7a66e3b93874f104f2d8ed8483ec..ef11ed1bd7684a4de01434d301fb5d258d45c224
@@@ -58,7 -58,7 +58,7 @@@ NOTMUCH_BEGIN_DECL
   * version in Makefile.local.
   */
  #define LIBNOTMUCH_MAJOR_VERSION        5
- #define LIBNOTMUCH_MINOR_VERSION        3
+ #define LIBNOTMUCH_MINOR_VERSION        4
  #define LIBNOTMUCH_MICRO_VERSION        0
  
  
@@@ -316,7 -316,7 +316,7 @@@ typedef enum 
  
  /**
   * Deprecated alias for notmuch_database_open_with_config with
-  * config_path=error_message=NULL
+  * config_path="" and error_message=NULL
   * @deprecated Deprecated as of libnotmuch 5.4 (notmuch 0.32)
   */
  /* NOTMUCH_DEPRECATED(5, 4) */
@@@ -326,7 -326,7 +326,7 @@@ notmuch_database_open (const char *path
                       notmuch_database_t **database);
  /**
   * Deprecated alias for notmuch_database_open_with_config with
-  * config_path=NULL
+  * config_path=""
   *
   * @deprecated Deprecated as of libnotmuch 5.4 (notmuch 0.32)
   *
@@@ -529,11 -529,11 +529,11 @@@ notmuch_database_status_string (const n
   * have no effect.
   *
   * For writable databases, notmuch_database_close commits all changes
 - * to disk before closing the database.  If the caller is currently in
 - * an atomic section (there was a notmuch_database_begin_atomic
 - * without a matching notmuch_database_end_atomic), this will discard
 - * changes made in that atomic section (but still commit changes made
 - * prior to entering the atomic section).
 + * to disk before closing the database, unless the caller is currently
 + * in an atomic section (there was a notmuch_database_begin_atomic
 + * without a matching notmuch_database_end_atomic). In this case
 + * changes since the last commit are discarded. @see
 + * notmuch_database_end_atomic for more information.
   *
   * Return value:
   *
@@@ -670,10 -670,7 +670,10 @@@ notmuch_status_
  notmuch_database_begin_atomic (notmuch_database_t *notmuch);
  
  /**
 - * Indicate the end of an atomic database operation.
 + * Indicate the end of an atomic database operation.  If repeated
 + * (with matching notmuch_database_begin_atomic) "database.autocommit"
 + * times, commit the the transaction and all previous (non-cancelled)
 + * transactions to the database.
   *
   * Return value:
   *
@@@ -2523,7 -2520,6 +2523,7 @@@ typedef enum _notmuch_config_key 
      NOTMUCH_CONFIG_PRIMARY_EMAIL,
      NOTMUCH_CONFIG_OTHER_EMAIL,
      NOTMUCH_CONFIG_USER_NAME,
 +    NOTMUCH_CONFIG_AUTOCOMMIT,
      NOTMUCH_CONFIG_LAST
  } notmuch_config_key_t;
  
diff --combined lib/open.cc
index 7b95c5b151d14f958f7b02341cd3eb27229ab285,137434592a3066a6d69d83ee2a365fd9a4095ebb..280ffee343f91e893a2743683290ea4b41c034ac
@@@ -220,6 -220,10 +220,10 @@@ _choose_database_path (void *ctx
        }
      }
  
+     if (! *database_path) {
+       *database_path = getenv ("MAILDIR");
+     }
      if (! *database_path) {
        notmuch_status_t status;
  
      return NOTMUCH_STATUS_SUCCESS;
  }
  
 -notmuch_database_t *
 +static notmuch_database_t *
  _alloc_notmuch ()
  {
      notmuch_database_t *notmuch;
      notmuch->writable_xapian_db = NULL;
      notmuch->config_path = NULL;
      notmuch->atomic_nesting = 0;
 +    notmuch->transaction_count = 0;
 +    notmuch->transaction_threshold = 0;
      notmuch->view = 1;
      return notmuch;
  }
@@@ -326,6 -328,24 +330,6 @@@ _set_database_path (notmuch_database_t 
      _notmuch_config_cache (notmuch, NOTMUCH_CONFIG_DATABASE_PATH, path);
  }
  
 -static void
 -_init_libs ()
 -{
 -
 -    static int initialized = 0;
 -
 -    /* Initialize the GLib type system and threads */
 -#if ! GLIB_CHECK_VERSION (2, 35, 1)
 -    g_type_init ();
 -#endif
 -
 -    /* Initialize gmime */
 -    if (! initialized) {
 -      g_mime_init ();
 -      initialized = 1;
 -    }
 -}
 -
  static void
  _load_database_state (notmuch_database_t *notmuch)
  {
@@@ -367,8 -387,6 +371,8 @@@ _finish_open (notmuch_database_t *notmu
      notmuch_status_t status = NOTMUCH_STATUS_SUCCESS;
      char *incompat_features;
      char *message = NULL;
 +    const char *autocommit_str;
 +    char *autocommit_end;
      unsigned int version;
      const char *database_path = notmuch_database_get_path (notmuch);
  
        if (status)
            goto DONE;
  
 +      autocommit_str = notmuch_config_get (notmuch, NOTMUCH_CONFIG_AUTOCOMMIT);
 +      if (unlikely (! autocommit_str)) {
 +          INTERNAL_ERROR ("missing configuration for autocommit");
 +      }
 +      notmuch->transaction_threshold = strtoul (autocommit_str, &autocommit_end, 10);
 +      if (*autocommit_end != '\0')
 +          INTERNAL_ERROR ("Malformed database database.autocommit value: %s", autocommit_str);
 +
        status = _notmuch_database_setup_standard_query_fields (notmuch);
        if (status)
            goto DONE;
@@@ -509,7 -519,7 +513,7 @@@ notmuch_database_open_with_config (cons
      GKeyFile *key_file = NULL;
      bool split = false;
  
 -    _init_libs ();
 +    _notmuch_init ();
  
      notmuch = _alloc_notmuch ();
      if (! notmuch) {
@@@ -606,7 -616,7 +610,7 @@@ notmuch_database_create_with_config (co
      int err;
      bool split = false;
  
 -    _init_libs ();
 +    _notmuch_init ();
  
      notmuch = _alloc_notmuch ();
      if (! notmuch) {
@@@ -767,7 -777,7 +771,7 @@@ notmuch_database_reopen (notmuch_databa
      return NOTMUCH_STATUS_SUCCESS;
  }
  
 -notmuch_status_t
 +static notmuch_status_t
  _maybe_load_config_from_database (notmuch_database_t *notmuch,
                                  GKeyFile *key_file,
                                  const char *database_path,
@@@ -802,7 -812,7 +806,7 @@@ notmuch_database_load_config (const cha
      GKeyFile *key_file = NULL;
      bool split = false;
  
 -    _init_libs ();
 +    _notmuch_init ();
  
      notmuch = _alloc_notmuch ();
      if (! notmuch) {
diff --combined notmuch-config.c
index 3430a3d35e7fe06052065575f21220457547d070,e5b4db45fdf53dcb4254bec0b321e1dfcbcf719e..4de55e5fb0010872207703b1063f3a296e7f99da
@@@ -32,7 -32,7 +32,7 @@@ static const char toplevel_config_comme
      "\n"
      " For more information about notmuch, see https://notmuchmail.org";
  
 -struct config_group {
 +static const struct config_group {
      const char *group_name;
      const char *comment;
  } group_comment_table [] = {
@@@ -512,14 -512,14 +512,14 @@@ typedef struct config_key 
      bool (*validate)(const char *);
  } config_key_info_t;
  
 -static struct config_key
 +static const struct config_key
      config_key_table[] = {
      { "index.decrypt",   false,  NULL },
      { "index.header.",   true,   validate_field_name },
      { "query.",          true,   NULL },
  };
  
 -static config_key_info_t *
 +static const config_key_info_t *
  _config_key_info (const char *item)
  {
      for (size_t i = 0; i < ARRAY_SIZE (config_key_table); i++) {
@@@ -538,11 -538,18 +538,18 @@@ notmuch_config_command_get (notmuch_dat
  {
      notmuch_config_values_t *list;
  
-     for (list = notmuch_config_get_values_string (notmuch, item);
-        notmuch_config_values_valid (list);
-        notmuch_config_values_move_to_next (list)) {
-       const char *val = notmuch_config_values_get (list);
-       puts (val);
+     if (STRNCMP_LITERAL (item, BUILT_WITH_PREFIX) == 0) {
+       if (notmuch_built_with (item + strlen (BUILT_WITH_PREFIX)))
+           puts ("true");
+       else
+           puts ("false");
+     } else {
+       for (list = notmuch_config_get_values_string (notmuch, item);
+            notmuch_config_values_valid (list);
+            notmuch_config_values_move_to_next (list)) {
+           const char *val = notmuch_config_values_get (list);
+           puts (val);
+       }
      }
      return EXIT_SUCCESS;
  }
@@@ -583,7 -590,7 +590,7 @@@ notmuch_config_command_set (notmuch_dat
                            int argc, char *argv[])
  {
      char *group, *key;
 -    config_key_info_t *key_info;
 +    const config_key_info_t *key_info;
      notmuch_conffile_t *config;
      bool update_database = false;
      int opt_index, ret;
diff --combined test/T030-config.sh
index 751feaf374fa1ec69af5afffb59f3eb5bf1488a3,f889747137a2e8c8444e57d245782c4bbc5620e3..636c6356bfa39ffd001ac9467daa600203f8b2be
@@@ -51,7 -51,6 +51,7 @@@ cat <<EOF > EXPECTE
  built_with.compact=something
  built_with.field_processor=something
  built_with.retry_lock=something
 +database.autocommit=8000
  database.mail_root=MAIL_DIR
  database.path=MAIL_DIR
  foo.list=this;is another;list value;
@@@ -145,4 -144,21 +145,21 @@@ notmuch config set --database ${key} ${
  output=$(notmuch config get ${key})
  test_expect_equal "${output}" "${value}"
  
+ test_begin_subtest "set built_with.* yields error"
+ test_expect_code 1 "notmuch config set built_with.compact false"
+ test_begin_subtest "get built_with.{compact,field_processor} prints true"
+ for key in compact field_processor; do
+     notmuch config get built_with.${key}
+ done > OUTPUT
+ cat <<EOF > EXPECTED
+ true
+ true
+ EOF
+ test_expect_equal_file EXPECTED OUTPUT
+ test_begin_subtest "get built_with.nonexistent prints false"
+ output=$(notmuch config get built_with.nonexistent)
+ test_expect_equal "$output" "false"
  test_done
diff --combined test/T055-path-config.sh
index bb3bf6657214642fb6b5b311d567c06e7a28af4e,3e782f6550bf1aa8e6bbc620b6c08315dcee8f8e..6f41e2cf067cafc2f08da288b375751fa589960d
@@@ -16,6 -16,7 +16,7 @@@ restore_config () 
      unset DATABASE_PATH
      unset NOTMUCH_PROFILE
      unset XAPIAN_PATH
+     unset MAILDIR
      rm -f "$HOME/mail"
      cp notmuch-config-backup.${test_name} ${NOTMUCH_CONFIG}
  }
@@@ -55,6 -56,18 +56,18 @@@ home_mail_config () 
      unset DATABASE_PATH
  }
  
+ maildir_env_config () {
+     local dir
+     backup_config
+     dir="${HOME}/env_points_here"
+     ln -s $MAIL_DIR $dir
+     export MAILDIR=$dir
+     notmuch config set database.path
+     notmuch config set database.mail_root
+     XAPIAN_PATH="${MAIL_DIR}/.notmuch/xapian"
+     unset DATABASE_PATH
+ }
  xdg_config () {
      local dir
      local profile=${1:-default}
@@@ -79,7 -92,7 +92,7 @@@
      notmuch --config=${CONFIG_PATH} config set database.path
  }
  
- for config in traditional split XDG XDG+profile symlink home_mail; do
+ for config in traditional split XDG XDG+profile symlink home_mail maildir_env; do
      #start each set of tests with an known set of messages
      add_email_corpus
  
        home_mail)
            home_mail_config
            ;;
+       maildir_env)
+           maildir_env_config
+           ;;
      esac
  
      test_begin_subtest "count ($config)"
@@@ -190,6 -206,7 +206,7 @@@ On Tue, 05 Jan 2010 15:43:56 -0000, Sen
  > basic reply test
  EOF
      test_expect_equal_file EXPECTED OUTPUT
      test_begin_subtest "insert+search ($config)"
      generate_message \
        "[subject]=\"insert-subject\"" \
@@@ -250,16 -267,17 +267,18 @@@ EO
     test_expect_equal "${output}+${output2}" "${value}+"
  
     test_begin_subtest "Config list ($config)"
-    notmuch config list | notmuch_dir_sanitize | sed -e "s/^database.backup_dir=.*$/database.backup_dir/"  \
-                                                   -e "s/^database.hook_dir=.*$/database.hook_dir/" \
-                                                   -e "s/^database.path=.*$/database.path/"  \
-                                                   -e "s,^database.mail_root=CWD/home/mail,database.mail_root=MAIL_DIR," \
-                                                   > OUTPUT
+    notmuch config list | notmuch_dir_sanitize | \
+        sed -e "s/^database.backup_dir=.*$/database.backup_dir/"  \
+          -e "s/^database.hook_dir=.*$/database.hook_dir/" \
+          -e "s/^database.path=.*$/database.path/"  \
+          -e "s,^database.mail_root=CWD/home/mail,database.mail_root=MAIL_DIR," \
+          -e "s,^database.mail_root=CWD/home/env_points_here,database.mail_root=MAIL_DIR," \
+          > OUTPUT
     cat <<EOF > EXPECTED
  built_with.compact=true
  built_with.field_processor=true
  built_with.retry_lock=true
 +database.autocommit=8000
  database.backup_dir
  database.hook_dir
  database.mail_root=MAIL_DIR