Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package notmuch for openSUSE:Factory checked 
in at 2021-06-09 21:52:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/notmuch (Old)
 and      /work/SRC/openSUSE:Factory/.notmuch.new.32437 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "notmuch"

Wed Jun  9 21:52:40 2021 rev:33 rq:898466 version:0.32.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/notmuch/notmuch.changes  2021-05-06 
22:53:42.914480286 +0200
+++ /work/SRC/openSUSE:Factory/.notmuch.new.32437/notmuch.changes       
2021-06-09 21:53:03.550555708 +0200
@@ -1,0 +2,26 @@
+Mon May 17 10:49:07 UTC 2021 - Dan ??erm??k <[email protected]>
+
+What's new in notmuch 0.32.1
+=========================
+
+General
+-------
+
+Restore handling of relative values for `database.path` that was
+broken by 0.32. Extend this handling to `database.mail_root`,
+`database.backup_dir`, and `database.hook_dir`.
+
+Reload certain metadata from Xapian database in
+notmuch_database_reopen. This fixes a bug when adding messages to the
+database in a pre-new hook.
+
+Fix default of `$HOME/mail` for `database.path`. In release 0.32, this
+default worked only in "notmuch config".
+
+Emacs
+-----
+
+Restore the dynamically bound variables `tag-changes` and `query` in
+in `notmuch-before-tag-hook` and `notmuch-after-tag-hook`.
+
+-------------------------------------------------------------------

Old:
----
  database-v1.tar.xz
  notmuch-0.32.tar.xz
  notmuch-0.32.tar.xz.asc

New:
----
  notmuch-0.32.1.tar.xz
  notmuch-0.32.1.tar.xz.asc

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ notmuch.spec ++++++
--- /var/tmp/diff_new_pack.GixCij/_old  2021-06-09 21:53:04.050556599 +0200
+++ /var/tmp/diff_new_pack.GixCij/_new  2021-06-09 21:53:04.050556599 +0200
@@ -18,14 +18,13 @@
 
 %define libversion 5
 Name:           notmuch
-Version:        0.32
+Version:        0.32.1
 Release:        0
 Summary:        The mail indexer
 License:        GPL-3.0-or-later
 URL:            https://notmuchmail.org
 Source0:        %{URL}/releases/notmuch-%{version}.tar.xz
 Source1:        %{URL}/releases/notmuch-%{version}.tar.xz.asc
-Source3:        %{URL}/releases/test-databases/database-v1.tar.xz
 # key fingerprint: 7A18 807F 100A 4570 C596  8420 7E4E 65C8 720B 706B
 Source4:        notmuch.keyring
 BuildRequires:  libxapian-devel
@@ -46,16 +45,16 @@
 
 # dtach is not present on SLE
 # cannot run the tests there
-%if 0%{is_opensuse}
+%if 0%{?is_opensuse}
 %{bcond_without tests}
 %else
 %{bcond_with tests}
 %endif
 # testsuite
 %if %{with tests}
+BuildRequires:  openssl
 BuildRequires:  dtach
 BuildRequires:  gdb
-BuildRequires:  gnu_parallel
 BuildRequires:  libgcrypt-cavs
 BuildRequires:  man
 BuildRequires:  valgrind-devel
@@ -127,7 +126,7 @@
 %if %{with python3}
 %package -n python3-%{name}
 Summary:        Python3 bindings for %{name}
-Requires:       python = %{py3_ver}
+Requires:       python = %{?py3_ver:%py3_ver}%{?!py3_ver:%(python3 
--version|awk '{print $2}')}
 Recommends:     python-%{name}-doc = %{version}
 
 %description -n python3-%{name}
@@ -205,7 +204,9 @@
 
 %check
 %if %{with tests}
-cp %{SOURCE3} test/test-databases
+
+# ensure that the tests are not running in parallel
+export NOTMUCH_TEST_SERIALIZE=t
 
 # this test fails on PPC64 (see id:[email protected])
 %ifarch ppc64

++++++ notmuch-0.32.tar.xz -> notmuch-0.32.1.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/notmuch-0.32/NEWS new/notmuch-0.32.1/NEWS
--- old/notmuch-0.32/NEWS       2021-05-02 12:05:44.000000000 +0200
+++ new/notmuch-0.32.1/NEWS     2021-05-15 14:04:24.000000000 +0200
@@ -1,3 +1,26 @@
+Notmuch 0.32.1 (2021-05-15)
+===========================
+
+General
+-------
+
+Restore handling of relative values for `database.path` that was
+broken by 0.32. Extend this handling to `database.mail_root`,
+`database.backup_dir`, and `database.hook_dir`.
+
+Reload certain metadata from Xapian database in
+notmuch_database_reopen. This fixes a bug when adding messages to the
+database in a pre-new hook.
+
+Fix default of `$HOME/mail` for `database.path`. In release 0.32, this
+default worked only in "notmuch config".
+
+Emacs
+-----
+
+Restore the dynamically bound variables `tag-changes` and `query` in
+in `notmuch-before-tag-hook` and `notmuch-after-tag-hook`.
+
 Notmuch 0.32 (2021-05-02)
 =========================
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/notmuch-0.32/bindings/python/notmuch/version.py 
new/notmuch-0.32.1/bindings/python/notmuch/version.py
--- old/notmuch-0.32/bindings/python/notmuch/version.py 2021-05-02 
12:05:44.000000000 +0200
+++ new/notmuch-0.32.1/bindings/python/notmuch/version.py       2021-05-15 
14:04:24.000000000 +0200
@@ -1,3 +1,3 @@
 # this file should be kept in sync with ../../../version
-__VERSION__ = '0.32'
+__VERSION__ = '0.32.1'
 SOVERSION = '5'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/notmuch-0.32/bindings/python-cffi/version.txt 
new/notmuch-0.32.1/bindings/python-cffi/version.txt
--- old/notmuch-0.32/bindings/python-cffi/version.txt   2021-05-02 
12:05:44.000000000 +0200
+++ new/notmuch-0.32.1/bindings/python-cffi/version.txt 2021-05-15 
14:04:24.000000000 +0200
@@ -1 +1 @@
-0.32
+0.32.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/notmuch-0.32/debian/changelog 
new/notmuch-0.32.1/debian/changelog
--- old/notmuch-0.32/debian/changelog   2021-05-02 12:05:44.000000000 +0200
+++ new/notmuch-0.32.1/debian/changelog 2021-05-15 14:04:24.000000000 +0200
@@ -1,3 +1,12 @@
+notmuch (0.32.1-1) experimental; urgency=medium
+
+  * New upstream bugfix release
+  * Configuration bug fixes (see /usr/share/doc/notmuch/NEWS.gz)
+  * Bug fix for {pre,after}-tag hooks in emacs, related to lexical scope
+    transition.
+
+ -- David Bremner <[email protected]>  Sat, 15 May 2021 09:01:27 -0300
+
 notmuch (0.32-1) experimental; urgency=medium
 
   * New upstream release
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/notmuch-0.32/doc/man1/notmuch-config.rst 
new/notmuch-0.32.1/doc/man1/notmuch-config.rst
--- old/notmuch-0.32/doc/man1/notmuch-config.rst        2021-05-02 
12:05:44.000000000 +0200
+++ new/notmuch-0.32.1/doc/man1/notmuch-config.rst      2021-05-15 
14:04:24.000000000 +0200
@@ -44,7 +44,9 @@
     characters. In a multiple-value item (a list), the values are
     separated by semicolon characters.
 
-The available configuration items are described below.
+The available configuration items are described below. Non-absolute
+paths are presumed relative to `$HOME` for items in section
+**database**.
 
 **database.path**
     Notmuch will store its database here, (in
@@ -63,6 +65,14 @@
     Default: For compatibility with older configurations, the value of
     database.path is used if **database.mail\_root** is unset.
 
+**database.backup_dir**
+    Directory to store tag dumps when upgrading database.
+
+    History: this configuration value was introduced in notmuch 0.32.
+
+    Default: A sibling directory of the Xapian database called
+    `backups`.
+
 **database.hook_dir**
 
     Directory containing hooks run by notmuch commands. See
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/notmuch-0.32/emacs/notmuch-compat.el 
new/notmuch-0.32.1/emacs/notmuch-compat.el
--- old/notmuch-0.32/emacs/notmuch-compat.el    2021-05-02 12:05:44.000000000 
+0200
+++ new/notmuch-0.32.1/emacs/notmuch-compat.el  2021-05-15 14:04:24.000000000 
+0200
@@ -41,6 +41,18 @@
 (unless (fboundp 'message--fold-long-headers)
   (add-hook 'message-header-hook 'notmuch-message--fold-long-headers))
 
+;; `dlet' isn't available until Emacs 28.1.  Below is a copy, with the
+;; addition of `with-no-warnings'.
+(defmacro notmuch-dlet (binders &rest body)
+  "Like `let*' but using dynamic scoping."
+  (declare (indent 1) (debug let))
+  `(let (_)
+     (with-no-warnings  ; Quiet "lacks a prefix" warning.
+       ,@(mapcar (lambda (binder)
+                  `(defvar ,(if (consp binder) (car binder) binder)))
+                binders))
+     (let* ,binders ,@body)))
+
 (provide 'notmuch-compat)
 
 ;;; notmuch-compat.el ends here
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/notmuch-0.32/emacs/notmuch-tag.el 
new/notmuch-0.32.1/emacs/notmuch-tag.el
--- old/notmuch-0.32/emacs/notmuch-tag.el       2021-05-02 12:05:44.000000000 
+0200
+++ new/notmuch-0.32.1/emacs/notmuch-tag.el     2021-05-15 14:04:24.000000000 
+0200
@@ -486,7 +486,9 @@
   (unless query
     (error "Nothing to tag!"))
   (when tag-changes
-    (run-hooks 'notmuch-before-tag-hook)
+    (notmuch-dlet ((tag-changes tag-changes)
+                  (query query))
+      (run-hooks 'notmuch-before-tag-hook))
     (if (<= (length query) notmuch-tag-argument-limit)
        (apply 'notmuch-call-notmuch-process "tag"
               (append tag-changes (list "--" query)))
@@ -494,7 +496,9 @@
       (let ((batch-op (concat (mapconcat #'notmuch-hex-encode tag-changes " ")
                              " -- " query)))
        (notmuch-call-notmuch-process :stdin-string batch-op "tag" "--batch")))
-    (run-hooks 'notmuch-after-tag-hook)))
+    (notmuch-dlet ((tag-changes tag-changes)
+                  (query query))
+      (run-hooks 'notmuch-after-tag-hook))))
 
 (defun notmuch-tag-change-list (tags &optional reverse)
   "Convert TAGS into a list of tag changes.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/notmuch-0.32/lib/config.cc 
new/notmuch-0.32.1/lib/config.cc
--- old/notmuch-0.32/lib/config.cc      2021-05-02 12:05:44.000000000 +0200
+++ new/notmuch-0.32.1/lib/config.cc    2021-05-15 14:04:24.000000000 +0200
@@ -46,6 +46,7 @@
 };
 
 static const char *_notmuch_config_key_to_string (notmuch_config_key_t key);
+static char *_expand_path (void *ctx, const char *key, const char *val);
 
 static int
 _notmuch_config_list_destroy (notmuch_config_list_t *list)
@@ -257,9 +258,10 @@
        return status;
 
     for (; notmuch_config_list_valid (list); notmuch_config_list_move_to_next 
(list)) {
-       _notmuch_string_map_append (notmuch->config,
-                                   notmuch_config_list_key (list),
-                                   notmuch_config_list_value (list));
+       const char *key = notmuch_config_list_key (list);
+       char *normalized_val = _expand_path (list, key, 
notmuch_config_list_value (list));
+       _notmuch_string_map_append (notmuch->config, key, normalized_val);
+       talloc_free (normalized_val);
     }
 
     return status;
@@ -387,6 +389,23 @@
     talloc_free (pairs);
 }
 
+static char *
+_expand_path (void *ctx, const char *key, const char *val)
+{
+    char *expanded_val;
+
+    if ((strcmp (key, "database.path") == 0 ||
+        strcmp (key, "database.mail_root") == 0 ||
+        strcmp (key, "database.hook_dir") == 0 ||
+        strcmp (key, "database.backup_path") == 0 ) &&
+       val[0] != '/')
+       expanded_val = talloc_asprintf (ctx, "%s/%s", getenv ("HOME"), val);
+    else
+       expanded_val = talloc_strdup (ctx, val);
+
+    return expanded_val;
+}
+
 notmuch_status_t
 _notmuch_config_load_from_file (notmuch_database_t *notmuch,
                                GKeyFile *file)
@@ -407,14 +426,17 @@
        keys = g_key_file_get_keys (file, *grp, NULL, NULL);
        for (gchar **keys_p = keys; *keys_p; keys_p++) {
            char *absolute_key = talloc_asprintf (notmuch, "%s.%s", *grp,  
*keys_p);
+           char *normalized_val;
            val = g_key_file_get_value (file, *grp, *keys_p, NULL);
            if (! val) {
                status = NOTMUCH_STATUS_FILE_ERROR;
                goto DONE;
            }
-           _notmuch_string_map_set (notmuch->config, absolute_key, val);
+           normalized_val = _expand_path (notmuch, absolute_key, val);
+           _notmuch_string_map_set (notmuch->config, absolute_key, 
normalized_val);
            g_free (val);
            talloc_free (absolute_key);
+           talloc_free (normalized_val);
            if (status)
                goto DONE;
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/notmuch-0.32/lib/open.cc 
new/notmuch-0.32.1/lib/open.cc
--- old/notmuch-0.32/lib/open.cc        2021-05-02 12:05:44.000000000 +0200
+++ new/notmuch-0.32.1/lib/open.cc      2021-05-15 14:04:24.000000000 +0200
@@ -209,8 +209,25 @@
        }
     }
     if (! *database_path) {
+       notmuch_status_t status;
+
        *database_path = _xdg_dir (ctx, "XDG_DATA_HOME", ".local/share", 
profile);
-       *split = true;
+       status = _db_dir_exists (*database_path, message);
+       if (status) {
+           *database_path = NULL;
+       } else {
+           *split = true;
+       }
+    }
+
+    if (! *database_path) {
+       notmuch_status_t status;
+
+       *database_path = talloc_asprintf (ctx, "%s/mail", getenv ("HOME"));
+       status = _db_dir_exists (*database_path, message);
+       if (status) {
+           *database_path = NULL;
+       }
     }
 
     if (*database_path == NULL) {
@@ -325,6 +342,37 @@
     }
 }
 
+static void
+_load_database_state (notmuch_database_t *notmuch)
+{
+    std::string last_thread_id;
+    std::string last_mod;
+
+    notmuch->last_doc_id = notmuch->xapian_db->get_lastdocid ();
+    last_thread_id = notmuch->xapian_db->get_metadata ("last_thread_id");
+    if (last_thread_id.empty ()) {
+       notmuch->last_thread_id = 0;
+    } else {
+       const char *str;
+       char *end;
+
+       str = last_thread_id.c_str ();
+       notmuch->last_thread_id = strtoull (str, &end, 16);
+       if (*end != '\0')
+           INTERNAL_ERROR ("Malformed database last_thread_id: %s", str);
+    }
+
+    /* Get current highest revision number. */
+    last_mod = notmuch->xapian_db->get_value_upper_bound (
+       NOTMUCH_VALUE_LAST_MOD);
+    if (last_mod.empty ())
+       notmuch->revision = 0;
+    else
+       notmuch->revision = Xapian::sortable_unserialise (last_mod);
+    notmuch->uuid = talloc_strdup (
+       notmuch, notmuch->xapian_db->get_uuid ().c_str ());
+}
+
 static notmuch_status_t
 _finish_open (notmuch_database_t *notmuch,
              const char *profile,
@@ -339,8 +387,6 @@
     const char *database_path = notmuch_database_get_path (notmuch);
 
     try {
-       std::string last_thread_id;
-       std::string last_mod;
 
        if (mode == NOTMUCH_DATABASE_MODE_READ_WRITE) {
            notmuch->writable_xapian_db = new Xapian::WritableDatabase 
(notmuch->xapian_path,
@@ -384,29 +430,7 @@
            goto DONE;
        }
 
-       notmuch->last_doc_id = notmuch->xapian_db->get_lastdocid ();
-       last_thread_id = notmuch->xapian_db->get_metadata ("last_thread_id");
-       if (last_thread_id.empty ()) {
-           notmuch->last_thread_id = 0;
-       } else {
-           const char *str;
-           char *end;
-
-           str = last_thread_id.c_str ();
-           notmuch->last_thread_id = strtoull (str, &end, 16);
-           if (*end != '\0')
-               INTERNAL_ERROR ("Malformed database last_thread_id: %s", str);
-       }
-
-       /* Get current highest revision number. */
-       last_mod = notmuch->xapian_db->get_value_upper_bound (
-           NOTMUCH_VALUE_LAST_MOD);
-       if (last_mod.empty ())
-           notmuch->revision = 0;
-       else
-           notmuch->revision = Xapian::sortable_unserialise (last_mod);
-       notmuch->uuid = talloc_strdup (
-           notmuch, notmuch->xapian_db->get_uuid ().c_str ());
+       _load_database_state (notmuch);
 
        notmuch->query_parser = new Xapian::QueryParser;
        notmuch->term_gen = new Xapian::TermGenerator;
@@ -733,6 +757,8 @@
                                                           DB_ACTION);
            }
        }
+
+       _load_database_state (notmuch);
     } catch (const Xapian::Error &error) {
        if (! notmuch->exception_reported) {
            _notmuch_database_log (notmuch, "Error: A Xapian exception 
reopening database: %s\n",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/notmuch-0.32/test/T030-config.sh 
new/notmuch-0.32.1/test/T030-config.sh
--- old/notmuch-0.32/test/T030-config.sh        2021-05-02 12:05:44.000000000 
+0200
+++ new/notmuch-0.32.1/test/T030-config.sh      2021-05-15 14:04:24.000000000 
+0200
@@ -117,12 +117,12 @@
 
 ln -s `pwd`/mail home/Maildir
 add_email_corpus
-test_begin_subtest "Relative database path expanded in open"
+test_begin_subtest "Relative database path expanded"
 notmuch config set database.path Maildir
-path=$(notmuch config get database.path)
+path=$(notmuch config get database.path | notmuch_dir_sanitize)
 count=$(notmuch count '*')
 test_expect_equal "${path} ${count}" \
-                 "Maildir 52"
+                 "CWD/home/Maildir 52"
 
 test_begin_subtest "Add config to database"
 notmuch new
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/notmuch-0.32/test/T050-new.sh 
new/notmuch-0.32.1/test/T050-new.sh
--- old/notmuch-0.32/test/T050-new.sh   2021-05-02 12:05:44.000000000 +0200
+++ new/notmuch-0.32.1/test/T050-new.sh 2021-05-15 14:04:24.000000000 +0200
@@ -394,6 +394,30 @@
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "Relative database path expanded in new"
+ln -s "$PWD/mail" home/Maildir
+notmuch config set database.path Maildir
+generate_message
+NOTMUCH_NEW > OUTPUT
+cat <<EOF >EXPECTED
+Added 1 new message to the database.
+EOF
+notmuch config set database.path ${MAIL_DIR}
+rm home/Maildir
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "Relative mail root (in db) expanded in new"
+ln -s "$PWD/mail" home/Maildir
+notmuch config set --database database.mail_root Maildir
+generate_message
+NOTMUCH_NEW > OUTPUT
+cat <<EOF >EXPECTED
+Added 1 new message to the database.
+EOF
+notmuch config set database.mail_root
+rm home/Maildir
+test_expect_equal_file EXPECTED OUTPUT
+
 add_email_corpus broken
 test_begin_subtest "reference loop does not crash"
 test_expect_code 0 "notmuch show --format=json id:[email protected] 
id:[email protected] > OUTPUT"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/notmuch-0.32/test/T055-path-config.sh 
new/notmuch-0.32.1/test/T055-path-config.sh
--- old/notmuch-0.32/test/T055-path-config.sh   2021-05-02 12:05:44.000000000 
+0200
+++ new/notmuch-0.32.1/test/T055-path-config.sh 2021-05-15 14:04:24.000000000 
+0200
@@ -16,6 +16,7 @@
     unset DATABASE_PATH
     unset NOTMUCH_PROFILE
     unset XAPIAN_PATH
+    rm -f "$HOME/mail"
     cp notmuch-config-backup.${test_name} ${NOTMUCH_CONFIG}
 }
 
@@ -42,6 +43,18 @@
     unset DATABASE_PATH
 }
 
+
+home_mail_config () {
+    local dir
+    backup_config
+    dir="${HOME}/mail"
+    ln -s $MAIL_DIR $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}
@@ -66,7 +79,7 @@
     notmuch --config=${CONFIG_PATH} config set database.path
 }
 
-for config in traditional split XDG XDG+profile symlink; do
+for config in traditional split XDG XDG+profile symlink home_mail; do
     #start each set of tests with an known set of messages
     add_email_corpus
 
@@ -90,6 +103,9 @@
        symlink)
            symlink_config
            ;;
+       home_mail)
+           home_mail_config
+           ;;
     esac
 
     test_begin_subtest "count ($config)"
@@ -236,7 +252,9 @@
    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/" > OUTPUT
+                                                   -e 
"s/^database.path=.*$/database.path/"  \
+                                                   -e 
"s,^database.mail_root=CWD/home/mail,database.mail_root=MAIL_DIR," \
+                                                   > OUTPUT
    cat <<EOF > EXPECTED
 built_with.compact=true
 built_with.field_processor=true
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/notmuch-0.32/test/T310-emacs.sh 
new/notmuch-0.32.1/test/T310-emacs.sh
--- old/notmuch-0.32/test/T310-emacs.sh 2021-05-02 12:05:44.000000000 +0200
+++ new/notmuch-0.32.1/test/T310-emacs.sh       2021-05-15 14:04:24.000000000 
+0200
@@ -161,6 +161,28 @@
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
unread)"
 
+test_begin_subtest "notmuch-show: before-tag-hook is run, variables are 
defined"
+output=$(test_emacs '(let ((notmuch-test-tag-hook-output nil)
+                 (notmuch-before-tag-hook (function notmuch-test-tag-hook)))
+              (notmuch-show 
"id:[email protected]")
+              (execute-kbd-macro "+activate-hook\n")
+              (execute-kbd-macro "-activate-hook\n")
+              notmuch-test-tag-hook-output)')
+test_expect_equal "$output" \
+'(("id:[email protected]" 
"-activate-hook")
+ ("id:[email protected]" 
"+activate-hook"))'
+
+test_begin_subtest "notmuch-show: after-tag-hook is run, variables are defined"
+output=$(test_emacs '(let ((notmuch-test-tag-hook-output nil)
+                 (notmuch-after-tag-hook (function notmuch-test-tag-hook)))
+              (notmuch-show 
"id:[email protected]")
+              (execute-kbd-macro "+activate-hook\n")
+              (execute-kbd-macro "-activate-hook\n")
+              notmuch-test-tag-hook-output)')
+test_expect_equal "$output" \
+'(("id:[email protected]" 
"-activate-hook")
+ ("id:[email protected]" 
"+activate-hook"))'
+
 test_begin_subtest "Message with .. in Message-Id:"
 add_message [id]=123..456@example '[subject]="Message with .. in Message-Id"'
 test_emacs '(notmuch-search "id:\"123..456@example\"")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/notmuch-0.32/test/T400-hooks.sh 
new/notmuch-0.32.1/test/T400-hooks.sh
--- old/notmuch-0.32/test/T400-hooks.sh 2021-05-02 12:05:44.000000000 +0200
+++ new/notmuch-0.32.1/test/T400-hooks.sh       2021-05-15 14:04:24.000000000 
+0200
@@ -28,6 +28,16 @@
     echo "${TOKEN}" > ${2}
 }
 
+create_change_hook () {
+    mkdir -p ${HOOK_DIR}
+    cat <<EOF >"${HOOK_DIR}/${1}"
+#!/bin/sh
+notmuch insert --no-hooks < ${2} > /dev/null
+rm -f ${2}
+EOF
+    chmod +x "${HOOK_DIR}/${1}"
+}
+
 create_failing_hook () {
     local HOOK_DIR=${2}
     mkdir -p ${HOOK_DIR}
@@ -43,7 +53,7 @@
 # create maildir structure for notmuch-insert
 mkdir -p "$MAIL_DIR"/{cur,new,tmp}
 
-for config in traditional profile explicit XDG split; do
+for config in traditional profile explicit relative XDG split; do
     unset NOTMUCH_PROFILE
     notmuch config set database.hook_dir
     notmuch config set database.path ${MAIL_DIR}
@@ -63,6 +73,11 @@
            mkdir -p $HOOK_DIR
            notmuch config set database.hook_dir $HOOK_DIR
            ;;
+       relative)
+           HOOK_DIR=${HOME}/.notmuch-hooks
+           mkdir -p $HOOK_DIR
+           notmuch config set database.hook_dir .notmuch-hooks
+           ;;
        XDG)
            HOOK_DIR=${HOME}/.config/notmuch/default/hooks
            ;;
@@ -171,6 +186,20 @@
     NOTMUCH_NEW
     test_expect_equal_file write.expected write.output
 
+    test_begin_subtest "add message in pre-new [${config}]"
+    rm -rf ${HOOK_DIR}
+    generate_message '[subject]="add msg in pre-new"'
+    id1=$gen_msg_id
+    create_change_hook "pre-new" $gen_msg_filename $HOOK_DIR
+    generate_message '[subject]="add msg in new"'
+    NOTMUCH_NEW
+    notmuch search id:$id1 or id:$gen_msg_id | notmuch_search_sanitize > OUTPUT
+    cat <<EOF | sed s'/^[ \t]*//' > EXPECTED
+    thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; add msg in pre-new 
(inbox unread)
+    thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; add msg in new (inbox 
unread)
+EOF
+    test_expect_equal_file EXPECTED OUTPUT
+
     rm -rf ${HOOK_DIR}
 done
 test_done
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/notmuch-0.32/test/T530-upgrade.sh 
new/notmuch-0.32.1/test/T530-upgrade.sh
--- old/notmuch-0.32/test/T530-upgrade.sh       2021-05-02 12:05:44.000000000 
+0200
+++ new/notmuch-0.32.1/test/T530-upgrade.sh     2021-05-15 14:04:24.000000000 
+0200
@@ -54,4 +54,23 @@
     restore_database
 done
 
+test_begin_subtest "upgrade with configured backup dir"
+notmuch config set database.backup_dir ${HOME}/backups
+delete_feature 'modification tracking'
+notmuch new | grep Backing | notmuch_dir_sanitize | sed 
's/dump-[0-9T]*/dump-XXX/' > OUTPUT
+cat <<EOF > EXPECTED
+Backing up tags to CWD/home/backups/dump-XXX.gz...
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "upgrade with relative configured backup dir"
+notmuch config set database.backup_dir ${HOME}/backups
+delete_feature 'modification tracking'
+notmuch new | grep Backing | notmuch_dir_sanitize | sed 
's/dump-[0-9T]*/dump-XXX/' > OUTPUT
+cat <<EOF > EXPECTED
+Backing up tags to CWD/home/backups/dump-XXX.gz...
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+
 test_done
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/notmuch-0.32/test/T560-lib-error.sh 
new/notmuch-0.32.1/test/T560-lib-error.sh
--- old/notmuch-0.32/test/T560-lib-error.sh     2021-05-02 12:05:44.000000000 
+0200
+++ new/notmuch-0.32.1/test/T560-lib-error.sh   2021-05-15 14:04:24.000000000 
+0200
@@ -22,7 +22,7 @@
 cat <<'EOF' >EXPECTED
 == stdout ==
 == stderr ==
-Error: Cannot open database at CWD/home/.local/share/notmuch/default: No such 
file or directory.
+Error: could not locate database.
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
@@ -93,7 +93,7 @@
 cat <<'EOF' >EXPECTED
 == stdout ==
 == stderr ==
-Error: Cannot open database at CWD/home/.local/share/notmuch/default: No such 
file or directory.
+Error: could not locate database.
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/notmuch-0.32/test/T590-libconfig.sh 
new/notmuch-0.32.1/test/T590-libconfig.sh
--- old/notmuch-0.32/test/T590-libconfig.sh     2021-05-02 12:05:44.000000000 
+0200
+++ new/notmuch-0.32.1/test/T590-libconfig.sh   2021-05-15 14:04:24.000000000 
+0200
@@ -546,8 +546,8 @@
 == stdout ==
 == stderr ==
 error opening database
-Something went wrong trying to read or write a file
-Error: Cannot open database at CWD/home/.local/share/notmuch/default: No such 
file or directory.
+No database found
+Error: could not locate database.
 
 EOF
 test_expect_equal_file EXPECTED OUTPUT
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/notmuch-0.32/test/test-lib.el 
new/notmuch-0.32.1/test/test-lib.el
--- old/notmuch-0.32/test/test-lib.el   2021-05-02 12:05:44.000000000 +0200
+++ new/notmuch-0.32.1/test/test-lib.el 2021-05-15 14:04:24.000000000 +0200
@@ -99,6 +99,9 @@
 (add-hook 'notmuch-hello-refresh-hook
          (lambda () (cl-incf notmuch-hello-refresh-hook-counter)))
 
+(defvar notmuch-test-tag-hook-output nil)
+(defun notmuch-test-tag-hook () (push (cons query tag-changes) 
notmuch-test-tag-hook-output))
+
 (defun notmuch-test-mark-links ()
   "Enclose links in the current buffer with << and >>."
   ;; Links are often created by jit-lock functions
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/notmuch-0.32/version.txt 
new/notmuch-0.32.1/version.txt
--- old/notmuch-0.32/version.txt        2021-05-02 12:05:44.000000000 +0200
+++ new/notmuch-0.32.1/version.txt      2021-05-15 14:04:24.000000000 +0200
@@ -1 +1 @@
-0.32
+0.32.1

Reply via email to