Python bindings and Xapian exceptions

2010-06-10 Thread David Edmondson
Is anything happening about:

  A Xapian exception occurred finding message: The revision being read
  has been discarded - you should call Xapian::Database::reopen() and
  retry the operation.

?

It makes the Python bindings almost useless to me.

dme.
-- 
David Edmondson, http://dme.org
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100610/ce85a196/attachment.pgp>


[PATCH v3 5/5] test: Set all times to UTC

2010-06-10 Thread Michal Sojka
In order to have repeatable test suite, all times in messages are set
to UTC time zone to match the time zone (TZ variable) set in
test-lib.sh.

Signed-off-by: Michal Sojka 
---
 test/t0004-thread-naming.sh|   32 ++--
 test/t0005-reply.sh|   28 
 test/t0010-from-line-heuristics.sh |   40 ++--
 test/t0012-encoding-issues.sh  |2 +-
 test/test-lib.sh   |2 +-
 5 files changed, 52 insertions(+), 52 deletions(-)

diff --git a/test/t0004-thread-naming.sh b/test/t0004-thread-naming.sh
index 88216f2..c77f726 100755
--- a/test/t0004-thread-naming.sh
+++ b/test/t0004-thread-naming.sh
@@ -3,17 +3,17 @@ test_description="naming of threads with changing subject"
 . ./test-lib.sh
 test_expect_success 'Generate some messages' '
 add_message "[subject]=\"thread-naming: Initial thread subject\"" \
-"[date]=\"Fri, 05 Jan 2001 15:43:56 -0800\"" &&
+"[date]=\"Fri, 05 Jan 2001 15:43:56 -\"" &&
 first=${gen_msg_cnt} &&
 parent=${gen_msg_id} &&
 add_message "[subject]=\"thread-naming: Older changed subject\"" \
-"[date]=\"Sat, 06 Jan 2001 15:43:56 -0800\"" \
+"[date]=\"Sat, 06 Jan 2001 15:43:56 -\"" \
 "[in-reply-to]=\<$parent\>" &&
 add_message "[subject]=\"thread-naming: Newer changed subject\"" \
-"[date]=\"Sun, 07 Jan 2001 15:43:56 -0800\"" \
+"[date]=\"Sun, 07 Jan 2001 15:43:56 -\"" \
 "[in-reply-to]=\<$parent\>" &&
 add_message "[subject]=\"thread-naming: Final thread subject\"" \
-"[date]=\"Mon, 08 Jan 2001 15:43:56 -0800\"" \
+"[date]=\"Mon, 08 Jan 2001 15:43:56 -\"" \
 "[in-reply-to]=\<$parent\>" &&
 final=${gen_msg_id}

@@ -43,7 +43,7 @@ pass_if_equal "$output" "thread:XXX   2001-01-07 [2/4] 
Notmuch Test Suite; threa
 '
 test_expect_success "Ignore added reply prefix (Re:)" '
 add_message "[subject]=\"Re: thread-naming: Initial thread subject\"" \
-"[date]=\"Tue, 09 Jan 2001 15:43:45 -0800\"" \
+"[date]=\"Tue, 09 Jan 2001 15:43:45 -\"" \
 "[in-reply-to]=\<$parent\>" &&
 output=$($NOTMUCH search --sort=newest-first thread-naming and tag:inbox | 
notmuch_search_sanitize) &&
 pass_if_equal "$output" "thread:XXX   2001-01-09 [3/5] Notmuch Test Suite; 
thread-naming: Initial thread subject (inbox unread)"
@@ -51,7 +51,7 @@ pass_if_equal "$output" "thread:XXX   2001-01-09 [3/5] 
Notmuch Test Suite; threa
 '
 test_expect_success "Ignore added reply prefix (Aw:)" '
 add_message "[subject]=\"Aw: thread-naming: Initial thread subject\"" \
-"[date]=\"Wed, 10 Jan 2001 15:43:45 -0800\"" \
+"[date]=\"Wed, 10 Jan 2001 15:43:45 -\"" \
 "[in-reply-to]=\<$parent\>" &&
 output=$($NOTMUCH search --sort=newest-first thread-naming and tag:inbox | 
notmuch_search_sanitize) &&
 pass_if_equal "$output" "thread:XXX   2001-01-10 [4/6] Notmuch Test Suite; 
thread-naming: Initial thread subject (inbox unread)"
@@ -59,7 +59,7 @@ pass_if_equal "$output" "thread:XXX   2001-01-10 [4/6] 
Notmuch Test Suite; threa
 '
 test_expect_success "Ignore added reply prefix (Vs:)" '
 add_message "[subject]=\"Vs: thread-naming: Initial thread subject\"" \
-"[date]=\"Thu, 11 Jan 2001 15:43:45 -0800\"" \
+"[date]=\"Thu, 11 Jan 2001 15:43:45 -\"" \
 "[in-reply-to]=\<$parent\>" &&
 output=$($NOTMUCH search --sort=newest-first thread-naming and tag:inbox | 
notmuch_search_sanitize) &&
 pass_if_equal "$output" "thread:XXX   2001-01-11 [5/7] Notmuch Test Suite; 
thread-naming: Initial thread subject (inbox unread)"
@@ -67,7 +67,7 @@ pass_if_equal "$output" "thread:XXX   2001-01-11 [5/7] 
Notmuch Test Suite; threa
 '
 test_expect_success "Ignore added reply prefix (Sv:)" '
 add_message "[subject]=\"Sv: thread-naming: Initial thread subject\"" \
-"[date]=\"Fri, 12 Jan 2001 15:43:45 -0800\"" \
+"[date]=\"Fri, 12 Jan 2001 15:43:45 -\"" \
 "[in-reply-to]=\<$parent\>" &&
 output=$($NOTMUCH search --sort=newest-first thread-naming and tag:inbox | 
notmuch_search_sanitize) &&
 pass_if_equal "$output" "thread:XXX   2001-01-12 [6/8] Notmuch Test Suite; 
thread-naming: Initial thread subject (inbox unread)"
@@ -81,7 +81,7 @@ Notmuch Test Suite  
(2001-01-05) (unread)
 Subject: thread-naming: Initial thread subject
 From: Notmuch Test Suite 
 To: Notmuch Test Suite 
-Date: Fri, 05 Jan 2001 15:43:56 -0800
+Date: Fri, 05 Jan 2001 15:43:56 -
 header}
 body{
 part{ ID: 1, Content-type: text/plain
@@ -95,7 +95,7 @@ Notmuch Test Suite  
(2001-01-06) (inbox unread)
 Subject: thread-naming: Older changed subject
 From: Notmuch Test Suite 
 To: Notmuch Test Suite 
-Date: Sat, 06 Jan 2001 15:43:56 -0800
+Date: Sat, 06 Jan 2001 15:43:56 -
 header}
 body{
 part{ ID: 1, Content-type: text/plain
@@ -109,7 +109,7 @@ Notmuch Test Suite  
(2001-01-07) 

[PATCH v3 4/5] Convert the actual tests to the new framework

2010-06-10 Thread Michal Sojka
The changes are:
- The notmuch-test was split into several files (t000?-*.sh).
- Removed helper functions which were moved to test-lib.sh
- Replaced every printf with test_expect_success.
- Test commands chained with && (test-lib.sh doesn't use "set -e" in
  order to complete the test suite even if something fails)
- Many variables such as ${MAIL_DIR} were properly quoted as they
  contain spaces.
- Changed quoting patterns in add_message and generate_message (single
  quotes are already used by the test framework).
- ${TEST_DIR} replaced by ${PWD}

QUICK HOWTO:

To run the whole test suite
make

To run only a single test
   ./t0001-new.sh

To stop on the first error
   ./t0001-new.sh -i
then mail store and database can be inspected in
"trash directory.t0001-new"

To see the output of tests
   ./t0001-new.sh -v

To not remove trash directory at the end:
   ./t0001-new.sh -d

To run all tests verbosely:
   make GIT_TEST_OPTS="-v"

Signed-off-by: Michal Sojka 
---
 test/notmuch-test| 1190 +-
 test/t-basic.sh  |2 +-
 test/t0001-new.sh|  164 +
 test/t0002-search.sh |  111 
 test/t0003-json.sh   |   46 ++
 test/t0004-thread-naming.sh  |  191 ++
 test/t0005-reply.sh  |  137 
 test/t0006-dump-restore.sh   |   30 +
 test/t0007-uuencode.sh   |   36 +
 test/t0008-threading-out-of-order.sh |   31 +
 test/t0009-author-reordering.sh  |   35 +
 test/t0010-from-line-heuristics.sh   |  215 ++
 test/t0011-long-msgid.sh |   29 +
 test/t0012-encoding-issues.sh|   25 +
 14 files changed, 1053 insertions(+), 1189 deletions(-)
 create mode 100755 test/t0001-new.sh
 create mode 100755 test/t0002-search.sh
 create mode 100755 test/t0003-json.sh
 create mode 100755 test/t0004-thread-naming.sh
 create mode 100755 test/t0005-reply.sh
 create mode 100755 test/t0006-dump-restore.sh
 create mode 100755 test/t0007-uuencode.sh
 create mode 100755 test/t0008-threading-out-of-order.sh
 create mode 100755 test/t0009-author-reordering.sh
 create mode 100755 test/t0010-from-line-heuristics.sh
 create mode 100755 test/t0011-long-msgid.sh
 create mode 100755 test/t0012-encoding-issues.sh

diff --git a/test/notmuch-test b/test/notmuch-test
index 00ac6b0..5c066ed 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -1,1190 +1,4 @@
 #!/bin/bash
-set -e

-# Messages contain time/date values with time zone and notmuch
-# displays them converted to the local time zone. We need to set fixed
-# timezone here so that the output of the tests is always the same
-# without regard to the time zone of where the test suite is run.
-export TZ=UTC+8
-
-find_notmuch_binary ()
-{
-dir=$1
-
-while [ -n "$dir" ]; do
-   bin=$dir/notmuch
-   if [ -x $bin ]; then
-   echo $bin
-   return
-   fi
-   dir=$(dirname $dir)
-   if [ "$dir" = "/" ]; then
-   break
-   fi
-done
-
-echo notmuch
-}
-
-increment_mtime_amount=0
-increment_mtime ()
-{
-dir=$1
-
-increment_mtime_amount=$((increment_mtime_amount + 1))
-touch -d "+${increment_mtime_amount} seconds" $dir
-}
-
-# Generate a new message in the mail directory, with a unique message
-# ID and subject. The message is not added to the index.
-#
-# After this function returns, the filename of the generated message
-# is available as $gen_msg_filename and the message ID is available as
-# $gen_msg_id .
-#
-# This function supports named parameters with the bash syntax for
-# assigning a value to an associative array ([name]=value). The
-# supported parameters are:
-#
-#  [dir]=directory/of/choice
-#
-#  Generate the message in directory 'directory/of/choice' within
-#  the mail store. The directory will be created if necessary.
-#
-#  [body]=text
-#
-#  Text to use as the body of the email message
-#
-#  '[from]="Some User "'
-#  '[to]="Some User "'
-#  '[subject]="Subject of email message"'
-#  '[date]="RFC 822 Date"'
-#
-#  Values for email headers. If not provided, default values will
-#  be generated instead.
-#
-#  '[cc]="Some User "'
-#  [reply-to]=some-address
-#  [in-reply-to]=
-#  [references]=
-#  [content-type]=content-type-specification
-#  '[header]=full header line, including keyword'
-#
-#  Additional values for email headers. If these are not provided
-#  then the relevant headers will simply not appear in the
-#  message.
-#
-#  '[id]=message-id'
-#
-#  Controls the message-id of the created message.
-gen_msg_cnt=0
-gen_msg_filename=""
-gen_msg_id=""
-generate_message ()
-{
-# This is our (bash-specific) magic for doing named parameters
-local -A template="($@)"
-local additional_headers
-
-gen_msg_cnt=$((gen_msg_cnt + 1))
-gen_msg_name=msg-$(printf "%03d" $gen_msg_cnt)
-
-if [ -z "${template[id]}" ]; then
-   

[PATCH v3 3/5] test: Update helper functions

2010-06-10 Thread Michal Sojka
Modify the helper functions to work with git-based test suite i.e.
1) Quote arguments where it is necessary.
2) Do not use $NOTMUCH. It is equal to "notmuch" since $PATH is set to
   the build tree.
3) Modify pass_if_equal to fit into the git-based test suite.

Signed-off-by: Michal Sojka 
---
 test/test-lib.sh |   33 +
 1 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index 7684c2e..d045820 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -221,10 +221,10 @@ remove_cr () {
 increment_mtime_amount=0
 increment_mtime ()
 {
-dir=$1
+dir="$1"

 increment_mtime_amount=$((increment_mtime_amount + 1))
-touch -d "+${increment_mtime_amount} seconds" $dir
+touch -d "+${increment_mtime_amount} seconds" "$dir"
 }

 # Generate a new message in the mail directory, with a unique message
@@ -291,7 +291,7 @@ generate_message ()
gen_msg_filename="${MAIL_DIR}/$gen_msg_name"
 else
gen_msg_filename="${MAIL_DIR}/${template[dir]}/$gen_msg_name"
-   mkdir -p $(dirname $gen_msg_filename)
+   mkdir -p "$(dirname "$gen_msg_filename")"
 fi

 if [ -z "${template[body]}" ]; then
@@ -346,7 +346,7 @@ ${additional_headers}"
 fi


-cat <$gen_msg_filename
+cat <"$gen_msg_filename"
 From: ${template[from]}
 To: ${template[to]}
 Message-Id: <${gen_msg_id}>
@@ -357,7 +357,7 @@ ${template[body]}
 EOF

 # Ensure that the mtime of the containing directory is updated
-increment_mtime $(dirname ${gen_msg_filename})
+increment_mtime "$(dirname "${gen_msg_filename}")"
 }

 # Generate a new message and add it to the index.
@@ -366,41 +366,34 @@ EOF
 # are also supported here, so see that function for details.
 add_message ()
 {
-generate_message "$@"
-
-$NOTMUCH new > /dev/null
+generate_message "$@" &&
+notmuch new > /dev/null
 }

-tests=0
-test_failures=0
-
 pass_if_equal ()
 {
 output=$1
 expected=$2

-tests=$((tests + 1))
-
 if [ "$output" = "$expected" ]; then
-   echo "  PASS"
+   true
 else
-   echo "  FAIL"
-   testname=test-$(printf "%03d" $tests)
+   testname=$this_test.$test_count
echo "$expected" > $testname.expected
echo "$output" > $testname.output
-   diff -u $testname.expected $testname.output || true
-   test_failures=$((test_failures + 1))
+   diff -u $testname.expected $testname.output
+   false
 fi
 }

 TEST_DIR=$(pwd)/test.$$
 MAIL_DIR=${TEST_DIR}/mail
 export NOTMUCH_CONFIG=${TEST_DIR}/notmuch-config
-NOTMUCH=$(find_notmuch_binary $(pwd))
+NOTMUCH=notmuch

 NOTMUCH_NEW ()
 {
-$NOTMUCH new | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* 
total file'
+notmuch new | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* 
total file'
 }

 notmuch_search_sanitize ()
-- 
1.7.1.3.g75e44



[PATCH v3 2/5] Update test framework for use with notmuch

2010-06-10 Thread Michal Sojka
This removes Git specific things from the test-lib.sh and adds helper
functions for notmuch taken from Carl's notmuch-test script. README is
also slightly modified to reflect the current state.

Signed-off-by: Michal Sojka 
---
 test/Makefile   |1 +
 test/README |   12 +-
 test/t-basic.sh |  335 +++---
 test/test-lib.sh|  374 +++
 4 files changed, 256 insertions(+), 466 deletions(-)

diff --git a/test/Makefile b/test/Makefile
index 25c559b..7a29eaa 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -6,6 +6,7 @@
 -include ../config.mak

 #GIT_TEST_OPTS=--verbose --debug
+SHELL=/bin/bash
 SHELL_PATH ?= $(SHELL)
 TAR ?= $(TAR)
 RM ?= rm -f
diff --git a/test/README b/test/README
index dcd3ebb..af27d60 100644
--- a/test/README
+++ b/test/README
@@ -165,10 +165,10 @@ Writing Tests
 -

 The test script is written as a shell script.  It should start
-with the standard "#!/bin/sh" with copyright notices, and an
+with the standard "#!/bin/bash" with copyright notices, and an
 assignment to variable 'test_description', like this:

-   #!/bin/sh
+   #!/bin/bash
#
# Copyright (c) 2005 Junio C Hamano
#
@@ -192,9 +192,11 @@ This test harness library does the following things:
  - If the script is invoked with command line argument --help
(or -h), it shows the test_description and exits.

- - Creates an empty test directory with an empty .git/objects
-   database and chdir(2) into it.  This directory is 't/trash directory'
-   if you must know, but I do not think you care.
+ - Creates a test directory with default notmuch-config and empty mail
+   store. This directory is 't/trash directory.' (note
+   the space) if you must know, but I do not think you care. The path
+   to notmuch-config is exported in NOTMUCH_CONFIG environment
+   variable and mail store path is stored in MAIL_DIR variable.

  - Defines standard test helper functions for your scripts to
use.  These functions are designed to make all scripts behave
diff --git a/test/t-basic.sh b/test/t-basic.sh
index 3ec9cbe..caade68 100755
--- a/test/t-basic.sh
+++ b/test/t-basic.sh
@@ -3,48 +3,39 @@
 # Copyright (c) 2005 Junio C Hamano
 #

-test_description='Test the very basics part #1.
-
-The rest of the test suite does not check the basic operation of git
-plumbing commands to work very carefully.  Their job is to concentrate
-on tricky features that caused bugs in the past to detect regression.
-
-This test runs very basic features, like registering things in cache,
-writing tree, etc.
-
-Note that this test *deliberately* hard-codes many expected object
-IDs.  When object ID computation changes, like in the previous case of
-swapping compression and hashing order, the person who is making the
-modification *should* take notice and update the test vectors here.
-'
+test_description='Tests the test framework itself.'

 
 # It appears that people try to run tests without building...

-../git >/dev/null
-if test $? != 1
+if ! test -x ../notmuch
 then
-   echo >&2 'You do not seem to have built git yet.'
+   echo >&2 'You do not seem to have built notmuch yet.'
exit 1
 fi

 . ./test-lib.sh

 
-# git init has been done in an empty repository.
-# make sure it is empty.
+# Test mail store prepared in test-lib.sh

-find .git/objects -type f -print >should-be-empty
 test_expect_success \
-'.git/objects should be empty after git init in an empty repo.' \
+'test that mail store was created' \
+'test -d "${MAIL_DIR}"'
+
+
+find "${MAIL_DIR}" -type f -print >should-be-empty
+test_expect_success \
+'mail store should be empty' \
 'cmp -s /dev/null should-be-empty'

-# also it should have 2 subdirectories; no fan-out anymore, pack, and info.
-# 3 is counting "objects" itself
-find .git/objects -type d -print >full-of-directories
 test_expect_success \
-'.git/objects should have 3 subdirectories.' \
-'test $(wc -l < full-of-directories) = 3'
+'NOTMUCH_CONFIG is set and points to an existing file' \
+'test -f "${NOTMUCH_CONFIG}"'
+
+test_expect_success \
+'PATH is set to this repository' \
+'test "`echo $PATH|cut -f1 -d:`" = "`dirname ${TEST_DIRECTORY}`"'

 
 # Test harness
@@ -94,296 +85,4 @@ test_expect_code 2 'failure to clean up causes the test to 
fail' '
 test_when_finished "(exit 2)"
 '

-
-# Basics of the basics
-
-# updating a new file without --add should fail.
-test_expect_success 'git update-index without --add should fail adding.' '
-test_must_fail git update-index should-be-empty
-'
-
-# and with --add it should succeed, even if it is empty (it used to fail).

[PATCH v3 1/5] Copy test framework from Git

2010-06-10 Thread Michal Sojka
Git uses a simple and yet powerful test framework, written in shell.
The framework is easy to use for both users and developers so I think
it would help if it is used in notmuch as well.

This is a copy of Git's test framework from commit
b6b0afdc30e066788592ca07c9a6c6936c68cc11 in git repository.

Signed-off-by: Michal Sojka 
---
 test/Makefile |   48 +++
 test/README   |  297 
 test/aggregate-results.sh |   34 ++
 test/t-basic.sh   |  389 +
 test/test-lib.sh  |  832 +
 5 files changed, 1600 insertions(+), 0 deletions(-)
 create mode 100644 test/Makefile
 create mode 100644 test/README
 create mode 100755 test/aggregate-results.sh
 create mode 100755 test/t-basic.sh
 create mode 100644 test/test-lib.sh

diff --git a/test/Makefile b/test/Makefile
new file mode 100644
index 000..25c559b
--- /dev/null
+++ b/test/Makefile
@@ -0,0 +1,48 @@
+# Run tests
+#
+# Copyright (c) 2005 Junio C Hamano
+#
+
+-include ../config.mak
+
+#GIT_TEST_OPTS=--verbose --debug
+SHELL_PATH ?= $(SHELL)
+TAR ?= $(TAR)
+RM ?= rm -f
+
+# Shell quote;
+SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
+
+T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
+TSVN = $(wildcard t91[0-9][0-9]-*.sh)
+
+all: pre-clean
+   $(MAKE) aggregate-results-and-cleanup
+
+$(T):
+   @echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ 
$(GIT_TEST_OPTS)
+
+pre-clean:
+   $(RM) -r test-results
+
+clean:
+   $(RM) -r 'trash directory'.* test-results
+   $(RM) t/cvsroot/CVSROOT/?*
+   $(RM) -r valgrind/bin
+
+aggregate-results-and-cleanup: $(T)
+   $(MAKE) aggregate-results
+   $(MAKE) clean
+
+aggregate-results:
+   '$(SHELL_PATH_SQ)' ./aggregate-results.sh test-results/t*-*
+
+# we can test NO_OPTIMIZE_COMMITS independently of LC_ALL
+full-svn-test:
+   $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=1 LC_ALL=C
+   $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=0 LC_ALL=en_US.UTF-8
+
+valgrind:
+   GIT_TEST_OPTS=--valgrind $(MAKE)
+
+.PHONY: pre-clean $(T) aggregate-results clean valgrind
diff --git a/test/README b/test/README
new file mode 100644
index 000..dcd3ebb
--- /dev/null
+++ b/test/README
@@ -0,0 +1,297 @@
+Core GIT Tests
+==
+
+This directory holds many test scripts for core GIT tools.  The
+first part of this short document describes how to run the tests
+and read their output.
+
+When fixing the tools or adding enhancements, you are strongly
+encouraged to add tests in this directory to cover what you are
+trying to fix or enhance.  The later part of this short document
+describes how your test scripts should be organized.
+
+
+Running Tests
+-
+
+The easiest way to run tests is to say "make".  This runs all
+the tests.
+
+*** t-basic.sh ***
+*   ok 1: .git/objects should be empty after git-init in an empty repo.
+*   ok 2: .git/objects should have 256 subdirectories.
+*   ok 3: git-update-index without --add should fail adding.
+...
+*   ok 23: no diff after checkout and git-update-index --refresh.
+* passed all 23 test(s)
+*** t0100-environment-names.sh ***
+*   ok 1: using old names should issue warnings.
+*   ok 2: using old names but having new names should not issue warnings.
+...
+
+Or you can run each test individually from command line, like
+this:
+
+$ sh ./t3001-ls-files-killed.sh
+*   ok 1: git-update-index --add to add various paths.
+*   ok 2: git-ls-files -k to show killed files.
+*   ok 3: validate git-ls-files -k output.
+* passed all 3 test(s)
+
+You can pass --verbose (or -v), --debug (or -d), and --immediate
+(or -i) command line argument to the test, or by setting GIT_TEST_OPTS
+appropriately before running "make".
+
+--verbose::
+   This makes the test more verbose.  Specifically, the
+   command being run and their output if any are also
+   output.
+
+--debug::
+   This may help the person who is developing a new test.
+   It causes the command defined with test_debug to run.
+
+--immediate::
+   This causes the test to immediately exit upon the first
+   failed test.
+
+--long-tests::
+   This causes additional long-running tests to be run (where
+   available), for more exhaustive testing.
+
+--valgrind::
+   Execute all Git binaries with valgrind and exit with status
+   126 on errors (just like regular tests, this will only stop
+   the test script when running under -i).  Valgrind errors
+   go to stderr, so you might want to pass the -v option, too.
+
+   Since it makes no sense to run the tests with --valgrind and
+   not see any output, this option implies --verbose.  For
+   convenience, it also implies --tee.
+
+--tee::
+   In addition to printing the test output to the terminal,
+   write it to files named 't/test-results/$TEST_NAME.out'.
+   As the names depend on the 

[PATCH v3 0/5] Git-based modularization of test suite

2010-06-10 Thread Michal Sojka
Hi,

this is an updated version of v2
(id:1273510084-19896-1-git-send-email-sojkam1 at fel.cvut.cz). It includes
all test suite changes which were done in master since v2. Also a few
minor bugs was fixed since v2, namely:
- Messages are generated with UTC time zone by default
- Unnecessary \n was remvoved from the title in t0005-reply.sh

Michal Sojka (5):
  Copy test framework from Git
  Update test framework for use with notmuch
  test: Update helper functions
  Convert the actual tests to the new framework
  test: Set all times to UTC

 test/Makefile|   49 ++
 test/README  |  299 +
 test/aggregate-results.sh|   34 +
 test/notmuch-test| 1190 +-
 test/t-basic.sh  |   88 +++
 test/t0001-new.sh|  164 +
 test/t0002-search.sh |  111 
 test/t0003-json.sh   |   46 ++
 test/t0004-thread-naming.sh  |  191 ++
 test/t0005-reply.sh  |  137 
 test/t0006-dump-restore.sh   |   30 +
 test/t0007-uuencode.sh   |   36 +
 test/t0008-threading-out-of-order.sh |   31 +
 test/t0009-author-reordering.sh  |   35 +
 test/t0010-from-line-heuristics.sh   |  215 ++
 test/t0011-long-msgid.sh |   29 +
 test/t0012-encoding-issues.sh|   25 +
 test/test-lib.sh |  913 ++
 18 files changed, 2435 insertions(+), 1188 deletions(-)
 create mode 100644 test/Makefile
 create mode 100644 test/README
 create mode 100755 test/aggregate-results.sh
 create mode 100755 test/t-basic.sh
 create mode 100755 test/t0001-new.sh
 create mode 100755 test/t0002-search.sh
 create mode 100755 test/t0003-json.sh
 create mode 100755 test/t0004-thread-naming.sh
 create mode 100755 test/t0005-reply.sh
 create mode 100755 test/t0006-dump-restore.sh
 create mode 100755 test/t0007-uuencode.sh
 create mode 100755 test/t0008-threading-out-of-order.sh
 create mode 100755 test/t0009-author-reordering.sh
 create mode 100755 test/t0010-from-line-heuristics.sh
 create mode 100755 test/t0011-long-msgid.sh
 create mode 100755 test/t0012-encoding-issues.sh
 create mode 100644 test/test-lib.sh



fix problem with notmuch-hello-nice-number

2010-06-10 Thread David Edmondson
On Wed, 09 Jun 2010 07:49:01 -0700, Dirk Hohndel  
wrote:
> Without this little patch notmuch fails with current git if there's a
> saved search that has zero results

How about:

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index a6e8a47..48bb6e3 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -115,6 +115,7 @@ Typically \",\" in the US and UK and \".\" in Europe."
 (while (> n 0)
   (push (% n 1000) result)
   (setq n (/ n 1000)))
+(setq result (or result '(0)))
 (apply #'concat
  (number-to-string (car result))
  (mapcar (lambda (elem)

dme.
-- 
David Edmondson, http://dme.org
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100610/0db9cf68/attachment.pgp>


fix problem with notmuch-hello-nice-number

2010-06-10 Thread Dirk Hohndel
On Thu, 10 Jun 2010 08:05:13 +0100, David Edmondson  wrote:
> On Wed, 09 Jun 2010 07:49:01 -0700, Dirk Hohndel  
> wrote:
> > Without this little patch notmuch fails with current git if there's a
> > saved search that has zero results
> 
> How about:
> 
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index a6e8a47..48bb6e3 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -115,6 +115,7 @@ Typically \",\" in the US and UK and \".\" in Europe."
>  (while (> n 0)
>(push (% n 1000) result)
>(setq n (/ n 1000)))
> +(setq result (or result '(0)))
>  (apply #'concat
>   (number-to-string (car result))
>   (mapcar (lambda (elem)
> 

Much better. Mine made sense when you looked at it - this one has a much
more emacs-y feel to it in that I need to stare at it for 30 seconds
before I can grasp what it does :-)

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center


[PATCH 0/4] Maildir synchronization

2010-06-10 Thread Michal Sojka
On Thu, 10 Jun 2010, Dirk Hohndel wrote:
> On Wed, 09 Jun 2010 19:52:42 +0100, Matt Fleming  
> wrote:
> I've been using them for a while as well and love the feature, but I
> keep running into situations where notmuch seems to get out of sync
> regarding file names on disk. I haven't done a lot of searching on what
> exactly causes this - but the symptom is that you'll open a message,
> read it and then try to do something on it (like, save an attachment)
> and suddenly are told that the message file on disk can't be found.
> Or that you reply to a message and just as you are trying to send the
> reply things fail for the same reason.

This is a known limitation.
>From id:1273580061-22580-3-git-send-email-sojkam1 at fel.cvut.cz:

   The reason is that when you view the message its unread tag is
   removed which leads to rename of the file, but Emacs still uses the
   original name to access the attachment.

   Workaround: close the message and open it again.

IMHO, the final solution to this issue would be the "notmuch cat"
command. With this command, emacs would not access the messages by file
name, but by message id. My previous notmuch cat patches didn't have
support for message id and I plan to work on this but not earlier than
the next month.

Bye
Michal


[PATCH v3 3/5] test: Update helper functions

2010-06-10 Thread Michal Sojka
Modify the helper functions to work with git-based test suite i.e.
1) Quote arguments where it is necessary.
2) Do not use $NOTMUCH. It is equal to notmuch since $PATH is set to
   the build tree.
3) Modify pass_if_equal to fit into the git-based test suite.

Signed-off-by: Michal Sojka sojk...@fel.cvut.cz
---
 test/test-lib.sh |   33 +
 1 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index 7684c2e..d045820 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -221,10 +221,10 @@ remove_cr () {
 increment_mtime_amount=0
 increment_mtime ()
 {
-dir=$1
+dir=$1
 
 increment_mtime_amount=$((increment_mtime_amount + 1))
-touch -d +${increment_mtime_amount} seconds $dir
+touch -d +${increment_mtime_amount} seconds $dir
 }
 
 # Generate a new message in the mail directory, with a unique message
@@ -291,7 +291,7 @@ generate_message ()
gen_msg_filename=${MAIL_DIR}/$gen_msg_name
 else
gen_msg_filename=${MAIL_DIR}/${template[dir]}/$gen_msg_name
-   mkdir -p $(dirname $gen_msg_filename)
+   mkdir -p $(dirname $gen_msg_filename)
 fi
 
 if [ -z ${template[body]} ]; then
@@ -346,7 +346,7 @@ ${additional_headers}
 fi
 
 
-cat EOF $gen_msg_filename
+cat EOF $gen_msg_filename
 From: ${template[from]}
 To: ${template[to]}
 Message-Id: ${gen_msg_id}
@@ -357,7 +357,7 @@ ${template[body]}
 EOF
 
 # Ensure that the mtime of the containing directory is updated
-increment_mtime $(dirname ${gen_msg_filename})
+increment_mtime $(dirname ${gen_msg_filename})
 }
 
 # Generate a new message and add it to the index.
@@ -366,41 +366,34 @@ EOF
 # are also supported here, so see that function for details.
 add_message ()
 {
-generate_message $@
-
-$NOTMUCH new  /dev/null
+generate_message $@ 
+notmuch new  /dev/null
 }
 
-tests=0
-test_failures=0
-
 pass_if_equal ()
 {
 output=$1
 expected=$2
 
-tests=$((tests + 1))
-
 if [ $output = $expected ]; then
-   echo   PASS
+   true
 else
-   echo   FAIL
-   testname=test-$(printf %03d $tests)
+   testname=$this_test.$test_count
echo $expected  $testname.expected
echo $output  $testname.output
-   diff -u $testname.expected $testname.output || true
-   test_failures=$((test_failures + 1))
+   diff -u $testname.expected $testname.output
+   false
 fi
 }
 
 TEST_DIR=$(pwd)/test.$$
 MAIL_DIR=${TEST_DIR}/mail
 export NOTMUCH_CONFIG=${TEST_DIR}/notmuch-config
-NOTMUCH=$(find_notmuch_binary $(pwd))
+NOTMUCH=notmuch
 
 NOTMUCH_NEW ()
 {
-$NOTMUCH new | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* 
total file'
+notmuch new | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* 
total file'
 }
 
 notmuch_search_sanitize ()
-- 
1.7.1.3.g75e44

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v3 0/5] Git-based modularization of test suite

2010-06-10 Thread Michal Sojka
Hi,

this is an updated version of v2
(id:1273510084-19896-1-git-send-email-sojk...@fel.cvut.cz). It includes
all test suite changes which were done in master since v2. Also a few
minor bugs was fixed since v2, namely:
- Messages are generated with UTC time zone by default
- Unnecessary \n was remvoved from the title in t0005-reply.sh

Michal Sojka (5):
  Copy test framework from Git
  Update test framework for use with notmuch
  test: Update helper functions
  Convert the actual tests to the new framework
  test: Set all times to UTC

 test/Makefile|   49 ++
 test/README  |  299 +
 test/aggregate-results.sh|   34 +
 test/notmuch-test| 1190 +-
 test/t-basic.sh  |   88 +++
 test/t0001-new.sh|  164 +
 test/t0002-search.sh |  111 
 test/t0003-json.sh   |   46 ++
 test/t0004-thread-naming.sh  |  191 ++
 test/t0005-reply.sh  |  137 
 test/t0006-dump-restore.sh   |   30 +
 test/t0007-uuencode.sh   |   36 +
 test/t0008-threading-out-of-order.sh |   31 +
 test/t0009-author-reordering.sh  |   35 +
 test/t0010-from-line-heuristics.sh   |  215 ++
 test/t0011-long-msgid.sh |   29 +
 test/t0012-encoding-issues.sh|   25 +
 test/test-lib.sh |  913 ++
 18 files changed, 2435 insertions(+), 1188 deletions(-)
 create mode 100644 test/Makefile
 create mode 100644 test/README
 create mode 100755 test/aggregate-results.sh
 create mode 100755 test/t-basic.sh
 create mode 100755 test/t0001-new.sh
 create mode 100755 test/t0002-search.sh
 create mode 100755 test/t0003-json.sh
 create mode 100755 test/t0004-thread-naming.sh
 create mode 100755 test/t0005-reply.sh
 create mode 100755 test/t0006-dump-restore.sh
 create mode 100755 test/t0007-uuencode.sh
 create mode 100755 test/t0008-threading-out-of-order.sh
 create mode 100755 test/t0009-author-reordering.sh
 create mode 100755 test/t0010-from-line-heuristics.sh
 create mode 100755 test/t0011-long-msgid.sh
 create mode 100755 test/t0012-encoding-issues.sh
 create mode 100644 test/test-lib.sh

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v3 2/5] Update test framework for use with notmuch

2010-06-10 Thread Michal Sojka
This removes Git specific things from the test-lib.sh and adds helper
functions for notmuch taken from Carl's notmuch-test script. README is
also slightly modified to reflect the current state.

Signed-off-by: Michal Sojka sojk...@fel.cvut.cz
---
 test/Makefile   |1 +
 test/README |   12 +-
 test/t-basic.sh |  335 +++---
 test/test-lib.sh|  374 +++
 4 files changed, 256 insertions(+), 466 deletions(-)

diff --git a/test/Makefile b/test/Makefile
index 25c559b..7a29eaa 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -6,6 +6,7 @@
 -include ../config.mak
 
 #GIT_TEST_OPTS=--verbose --debug
+SHELL=/bin/bash
 SHELL_PATH ?= $(SHELL)
 TAR ?= $(TAR)
 RM ?= rm -f
diff --git a/test/README b/test/README
index dcd3ebb..af27d60 100644
--- a/test/README
+++ b/test/README
@@ -165,10 +165,10 @@ Writing Tests
 -
 
 The test script is written as a shell script.  It should start
-with the standard #!/bin/sh with copyright notices, and an
+with the standard #!/bin/bash with copyright notices, and an
 assignment to variable 'test_description', like this:
 
-   #!/bin/sh
+   #!/bin/bash
#
# Copyright (c) 2005 Junio C Hamano
#
@@ -192,9 +192,11 @@ This test harness library does the following things:
  - If the script is invoked with command line argument --help
(or -h), it shows the test_description and exits.
 
- - Creates an empty test directory with an empty .git/objects
-   database and chdir(2) into it.  This directory is 't/trash directory'
-   if you must know, but I do not think you care.
+ - Creates a test directory with default notmuch-config and empty mail
+   store. This directory is 't/trash directory.test-basename' (note
+   the space) if you must know, but I do not think you care. The path
+   to notmuch-config is exported in NOTMUCH_CONFIG environment
+   variable and mail store path is stored in MAIL_DIR variable.
 
  - Defines standard test helper functions for your scripts to
use.  These functions are designed to make all scripts behave
diff --git a/test/t-basic.sh b/test/t-basic.sh
index 3ec9cbe..caade68 100755
--- a/test/t-basic.sh
+++ b/test/t-basic.sh
@@ -3,48 +3,39 @@
 # Copyright (c) 2005 Junio C Hamano
 #
 
-test_description='Test the very basics part #1.
-
-The rest of the test suite does not check the basic operation of git
-plumbing commands to work very carefully.  Their job is to concentrate
-on tricky features that caused bugs in the past to detect regression.
-
-This test runs very basic features, like registering things in cache,
-writing tree, etc.
-
-Note that this test *deliberately* hard-codes many expected object
-IDs.  When object ID computation changes, like in the previous case of
-swapping compression and hashing order, the person who is making the
-modification *should* take notice and update the test vectors here.
-'
+test_description='Tests the test framework itself.'
 
 
 # It appears that people try to run tests without building...
 
-../git /dev/null
-if test $? != 1
+if ! test -x ../notmuch
 then
-   echo 2 'You do not seem to have built git yet.'
+   echo 2 'You do not seem to have built notmuch yet.'
exit 1
 fi
 
 . ./test-lib.sh
 
 
-# git init has been done in an empty repository.
-# make sure it is empty.
+# Test mail store prepared in test-lib.sh
 
-find .git/objects -type f -print should-be-empty
 test_expect_success \
-'.git/objects should be empty after git init in an empty repo.' \
+'test that mail store was created' \
+'test -d ${MAIL_DIR}'
+
+
+find ${MAIL_DIR} -type f -print should-be-empty
+test_expect_success \
+'mail store should be empty' \
 'cmp -s /dev/null should-be-empty'
 
-# also it should have 2 subdirectories; no fan-out anymore, pack, and info.
-# 3 is counting objects itself
-find .git/objects -type d -print full-of-directories
 test_expect_success \
-'.git/objects should have 3 subdirectories.' \
-'test $(wc -l  full-of-directories) = 3'
+'NOTMUCH_CONFIG is set and points to an existing file' \
+'test -f ${NOTMUCH_CONFIG}'
+
+test_expect_success \
+'PATH is set to this repository' \
+'test `echo $PATH|cut -f1 -d:` = `dirname ${TEST_DIRECTORY}`'
 
 
 # Test harness
@@ -94,296 +85,4 @@ test_expect_code 2 'failure to clean up causes the test to 
fail' '
 test_when_finished (exit 2)
 '
 
-
-# Basics of the basics
-
-# updating a new file without --add should fail.
-test_expect_success 'git update-index without --add should fail adding.' '
-test_must_fail git update-index should-be-empty
-'
-
-# and with --add it should succeed, even if it is empty (it used to 

[PATCH v3 1/5] Copy test framework from Git

2010-06-10 Thread Michal Sojka
Git uses a simple and yet powerful test framework, written in shell.
The framework is easy to use for both users and developers so I think
it would help if it is used in notmuch as well.

This is a copy of Git's test framework from commit
b6b0afdc30e066788592ca07c9a6c6936c68cc11 in git repository.

Signed-off-by: Michal Sojka sojk...@fel.cvut.cz
---
 test/Makefile |   48 +++
 test/README   |  297 
 test/aggregate-results.sh |   34 ++
 test/t-basic.sh   |  389 +
 test/test-lib.sh  |  832 +
 5 files changed, 1600 insertions(+), 0 deletions(-)
 create mode 100644 test/Makefile
 create mode 100644 test/README
 create mode 100755 test/aggregate-results.sh
 create mode 100755 test/t-basic.sh
 create mode 100644 test/test-lib.sh

diff --git a/test/Makefile b/test/Makefile
new file mode 100644
index 000..25c559b
--- /dev/null
+++ b/test/Makefile
@@ -0,0 +1,48 @@
+# Run tests
+#
+# Copyright (c) 2005 Junio C Hamano
+#
+
+-include ../config.mak
+
+#GIT_TEST_OPTS=--verbose --debug
+SHELL_PATH ?= $(SHELL)
+TAR ?= $(TAR)
+RM ?= rm -f
+
+# Shell quote;
+SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
+
+T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
+TSVN = $(wildcard t91[0-9][0-9]-*.sh)
+
+all: pre-clean
+   $(MAKE) aggregate-results-and-cleanup
+
+$(T):
+   @echo *** $@ ***; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ 
$(GIT_TEST_OPTS)
+
+pre-clean:
+   $(RM) -r test-results
+
+clean:
+   $(RM) -r 'trash directory'.* test-results
+   $(RM) t/cvsroot/CVSROOT/?*
+   $(RM) -r valgrind/bin
+
+aggregate-results-and-cleanup: $(T)
+   $(MAKE) aggregate-results
+   $(MAKE) clean
+
+aggregate-results:
+   '$(SHELL_PATH_SQ)' ./aggregate-results.sh test-results/t*-*
+
+# we can test NO_OPTIMIZE_COMMITS independently of LC_ALL
+full-svn-test:
+   $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=1 LC_ALL=C
+   $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=0 LC_ALL=en_US.UTF-8
+
+valgrind:
+   GIT_TEST_OPTS=--valgrind $(MAKE)
+
+.PHONY: pre-clean $(T) aggregate-results clean valgrind
diff --git a/test/README b/test/README
new file mode 100644
index 000..dcd3ebb
--- /dev/null
+++ b/test/README
@@ -0,0 +1,297 @@
+Core GIT Tests
+==
+
+This directory holds many test scripts for core GIT tools.  The
+first part of this short document describes how to run the tests
+and read their output.
+
+When fixing the tools or adding enhancements, you are strongly
+encouraged to add tests in this directory to cover what you are
+trying to fix or enhance.  The later part of this short document
+describes how your test scripts should be organized.
+
+
+Running Tests
+-
+
+The easiest way to run tests is to say make.  This runs all
+the tests.
+
+*** t-basic.sh ***
+*   ok 1: .git/objects should be empty after git-init in an empty repo.
+*   ok 2: .git/objects should have 256 subdirectories.
+*   ok 3: git-update-index without --add should fail adding.
+...
+*   ok 23: no diff after checkout and git-update-index --refresh.
+* passed all 23 test(s)
+*** t0100-environment-names.sh ***
+*   ok 1: using old names should issue warnings.
+*   ok 2: using old names but having new names should not issue warnings.
+...
+
+Or you can run each test individually from command line, like
+this:
+
+$ sh ./t3001-ls-files-killed.sh
+*   ok 1: git-update-index --add to add various paths.
+*   ok 2: git-ls-files -k to show killed files.
+*   ok 3: validate git-ls-files -k output.
+* passed all 3 test(s)
+
+You can pass --verbose (or -v), --debug (or -d), and --immediate
+(or -i) command line argument to the test, or by setting GIT_TEST_OPTS
+appropriately before running make.
+
+--verbose::
+   This makes the test more verbose.  Specifically, the
+   command being run and their output if any are also
+   output.
+
+--debug::
+   This may help the person who is developing a new test.
+   It causes the command defined with test_debug to run.
+
+--immediate::
+   This causes the test to immediately exit upon the first
+   failed test.
+
+--long-tests::
+   This causes additional long-running tests to be run (where
+   available), for more exhaustive testing.
+
+--valgrind::
+   Execute all Git binaries with valgrind and exit with status
+   126 on errors (just like regular tests, this will only stop
+   the test script when running under -i).  Valgrind errors
+   go to stderr, so you might want to pass the -v option, too.
+
+   Since it makes no sense to run the tests with --valgrind and
+   not see any output, this option implies --verbose.  For
+   convenience, it also implies --tee.
+
+--tee::
+   In addition to printing the test output to the terminal,
+   write it to files named 't/test-results/$TEST_NAME.out'.
+   As the names 

Re: fix problem with notmuch-hello-nice-number

2010-06-10 Thread David Edmondson
On Wed, 09 Jun 2010 07:49:01 -0700, Dirk Hohndel hohn...@infradead.org wrote:
 Without this little patch notmuch fails with current git if there's a
 saved search that has zero results

How about:

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index a6e8a47..48bb6e3 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -115,6 +115,7 @@ Typically \,\ in the US and UK and \.\ in Europe.
 (while ( n 0)
   (push (% n 1000) result)
   (setq n (/ n 1000)))
+(setq result (or result '(0)))
 (apply #'concat
  (number-to-string (car result))
  (mapcar (lambda (elem)

dme.
-- 
David Edmondson, http://dme.org


pgpwjrhLBXUpM.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Python bindings and Xapian exceptions

2010-06-10 Thread David Edmondson
Is anything happening about:

  A Xapian exception occurred finding message: The revision being read
  has been discarded - you should call Xapian::Database::reopen() and
  retry the operation.

?

It makes the Python bindings almost useless to me.

dme.
-- 
David Edmondson, http://dme.org


pgpTcNZm7iU5m.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: fix problem with notmuch-hello-nice-number

2010-06-10 Thread Dirk Hohndel
On Thu, 10 Jun 2010 08:05:13 +0100, David Edmondson d...@dme.org wrote:
 On Wed, 09 Jun 2010 07:49:01 -0700, Dirk Hohndel hohn...@infradead.org 
 wrote:
  Without this little patch notmuch fails with current git if there's a
  saved search that has zero results
 
 How about:
 
 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
 index a6e8a47..48bb6e3 100644
 --- a/emacs/notmuch-hello.el
 +++ b/emacs/notmuch-hello.el
 @@ -115,6 +115,7 @@ Typically \,\ in the US and UK and \.\ in Europe.
  (while ( n 0)
(push (% n 1000) result)
(setq n (/ n 1000)))
 +(setq result (or result '(0)))
  (apply #'concat
   (number-to-string (car result))
   (mapcar (lambda (elem)
 

Much better. Mine made sense when you looked at it - this one has a much
more emacs-y feel to it in that I need to stare at it for 30 seconds
before I can grasp what it does :-)

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch