[PATCH 1/2] cli/show: list all filenames of a message in the formatted output

Tomi Ollila tomi.ollila at iki.fi
Sun Feb 26 01:00:17 PST 2017


On Sat, Feb 25 2017, Jani Nikula <jani at nikula.org> wrote:

> Instead of just having the first filename for the message, list all
> duplicate filenames of the message as a list in the formatted
> outputs. This bumps the format version to 3.
>
> ---

Looks good to me. Tests pass.

Tomi


>
> v2: fix tests, and fix bugs found by the added tests :)
>
> I presume the UI could do fancy things with this to highlight messages
> with dupes better. I haven't quite figured out yet what that could be,
> but this seems like the right thing to do regardless.
> ---
>  devel/schemata               |  5 ++++-
>  notmuch-client.h             |  2 +-
>  notmuch-show.c               | 15 ++++++++++++++-
>  test/T070-insert.sh          |  2 +-
>  test/T160-json.sh            | 10 +++++-----
>  test/T170-sexp.sh            | 10 +++++-----
>  test/T190-multipart.sh       |  6 +++---
>  test/T220-reply.sh           |  2 +-
>  test/T340-maildir-sync.sh    |  2 +-
>  test/T350-crypto.sh          | 14 +++++++-------
>  test/T355-smime.sh           |  2 +-
>  test/T470-missing-headers.sh |  4 ++--
>  test/T510-thread-replies.sh  | 22 +++++++++++-----------
>  test/test-lib.sh             |  2 +-
>  14 files changed, 57 insertions(+), 41 deletions(-)
>
> diff --git a/devel/schemata b/devel/schemata
> index 41dc4a60fff3..6dede7a453d7 100644
> --- a/devel/schemata
> +++ b/devel/schemata
> @@ -26,6 +26,9 @@ v1
>  v2
>  - Added the thread_summary.query field.
>  
> +v3
> +- Replaced message.filename string with a list of filenames.
> +
>  Common non-terminals
>  --------------------
>  
> @@ -59,7 +62,7 @@ message = {
>      # (format_message_sprinter)
>      id:             messageid,
>      match:          bool,
> -    filename:	    string,
> +    filename:	    [string*],
>      timestamp:      unix_time, # date header as unix time
>      date_relative:  string,   # user-friendly timestamp
>      tags:           [string*],
> diff --git a/notmuch-client.h b/notmuch-client.h
> index d026e6004239..21b087980a17 100644
> --- a/notmuch-client.h
> +++ b/notmuch-client.h
> @@ -145,7 +145,7 @@ chomp_newline (char *str)
>   * this.  New (required) map fields can be added without increasing
>   * this.
>   */
> -#define NOTMUCH_FORMAT_CUR 2
> +#define NOTMUCH_FORMAT_CUR 3
>  /* The minimum supported structured output format version.  Requests
>   * for format versions below this will return an error. */
>  #define NOTMUCH_FORMAT_MIN 1
> diff --git a/notmuch-show.c b/notmuch-show.c
> index 22fa655ad20d..ab4ea1c2bdc1 100644
> --- a/notmuch-show.c
> +++ b/notmuch-show.c
> @@ -133,7 +133,20 @@ format_message_sprinter (sprinter_t *sp, notmuch_message_t *message)
>      sp->boolean (sp, notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED));
>  
>      sp->map_key (sp, "filename");
> -    sp->string (sp, notmuch_message_get_filename (message));
> +    if (notmuch_format_version >= 3) {
> +	notmuch_filenames_t *filenames;
> +
> +	sp->begin_list (sp);
> +	for (filenames = notmuch_message_get_filenames (message);
> +	     notmuch_filenames_valid (filenames);
> +	     notmuch_filenames_move_to_next (filenames)) {
> +	    sp->string (sp, notmuch_filenames_get (filenames));
> +	}
> +	notmuch_filenames_destroy (filenames);
> +	sp->end (sp);
> +    } else {
> +	sp->string (sp, notmuch_message_get_filename (message));
> +    }
>  
>      sp->map_key (sp, "timestamp");
>      date = notmuch_message_get_date (message);
> diff --git a/test/T070-insert.sh b/test/T070-insert.sh
> index 3dd76737c530..9120debabf8c 100755
> --- a/test/T070-insert.sh
> +++ b/test/T070-insert.sh
> @@ -43,7 +43,7 @@ expected='[[[{
>   "id": "'"${gen_msg_id}"'",
>   "match": true,
>   "excluded": false,
> - "filename": "'"${cur_msg_filename}"'",
> + "filename": ["'"${cur_msg_filename}"'"],
>   "timestamp": 946728000,
>   "date_relative": "2000-01-01",
>   "tags": ["inbox","unread"],
> diff --git a/test/T160-json.sh b/test/T160-json.sh
> index b346f37ee471..099632b4a286 100755
> --- a/test/T160-json.sh
> +++ b/test/T160-json.sh
> @@ -5,16 +5,16 @@ test_description="--format=json output"
>  test_begin_subtest "Show message: json"
>  add_message "[subject]=\"json-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[bcc]=\"test_suite+bcc at notmuchmail.org\"" "[reply-to]=\"test_suite+replyto at notmuchmail.org\"" "[body]=\"json-show-message\""
>  output=$(notmuch show --format=json "json-show-message")
> -test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"Bcc\": \"test_suite+bcc at notmuchmail.org\", \"Reply-To\": \"test_suite+replyto at notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"
> +test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": [\"${gen_msg_filename}\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"Bcc\": \"test_suite+bcc at notmuchmail.org\", \"Reply-To\": \"test_suite+replyto at notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"
>  
>  # This should be the same output as above.
>  test_begin_subtest "Show message: json --body=true"
>  output=$(notmuch show --format=json --body=true "json-show-message")
> -test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"Bcc\": \"test_suite+bcc at notmuchmail.org\", \"Reply-To\": \"test_suite+replyto at notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"
> +test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": [\"${gen_msg_filename}\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"Bcc\": \"test_suite+bcc at notmuchmail.org\", \"Reply-To\": \"test_suite+replyto at notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"
>  
>  test_begin_subtest "Show message: json --body=false"
>  output=$(notmuch show --format=json --body=false "json-show-message")
> -test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"Bcc\": \"test_suite+bcc at notmuchmail.org\", \"Reply-To\": \"test_suite+replyto at notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}}, []]]]"
> +test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": [\"${gen_msg_filename}\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"Bcc\": \"test_suite+bcc at notmuchmail.org\", \"Reply-To\": \"test_suite+replyto at notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}}, []]]]"
>  
>  test_begin_subtest "Search message: json"
>  add_message "[subject]=\"json-search-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"json-search-message\""
> @@ -33,7 +33,7 @@ test_expect_equal_json "$output" "[{\"thread\": \"XXX\",
>  test_begin_subtest "Show message: json, utf-8"
>  add_message "[subject]=\"json-show-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-show-méssage\""
>  output=$(notmuch show --format=json "jsön-show-méssage")
> -test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-utf8-body-sübjéct\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"jsön-show-méssage\n\"}]}, []]]]"
> +test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": [\"${gen_msg_filename}\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-utf8-body-sübjéct\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"jsön-show-méssage\n\"}]}, []]]]"
>  
>  test_begin_subtest "Show message: json, inline attachment filename"
>  subject='json-show-inline-attachment-filename'
> @@ -48,7 +48,7 @@ output=$(notmuch show --format=json "id:$id")
>  filename=$(notmuch search --output=files "id:$id")
>  # Get length of README after base64-encoding, minus additional newline.
>  attachment_length=$(( $(base64 $TEST_DIRECTORY/README | wc -c) - 1 ))
> -test_expect_equal_json "$output" "[[[{\"id\": \"$id\", \"match\": true, \"excluded\": false, \"filename\": \"$filename\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\"], \"headers\": {\"Subject\": \"$subject\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"test_suite at notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"multipart/mixed\", \"content\": [{\"id\": 2, \"content-type\": \"text/plain\", \"content\": \"This is a test message with inline attachment with a filename\"}, {\"id\": 3, \"content-type\": \"application/octet-stream\", \"content-length\": $attachment_length, \"content-transfer-encoding\": \"base64\", \"filename\": \"README\"}]}]}, []]]]"
> +test_expect_equal_json "$output" "[[[{\"id\": \"$id\", \"match\": true, \"excluded\": false, \"filename\": [\"$filename\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\"], \"headers\": {\"Subject\": \"$subject\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"test_suite at notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"multipart/mixed\", \"content\": [{\"id\": 2, \"content-type\": \"text/plain\", \"content\": \"This is a test message with inline attachment with a filename\"}, {\"id\": 3, \"content-type\": \"application/octet-stream\", \"content-length\": $attachment_length, \"content-transfer-encoding\": \"base64\", \"filename\": \"README\"}]}]}, []]]]"
>  
>  test_begin_subtest "Search message: json, utf-8"
>  add_message "[subject]=\"json-search-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-search-méssage\""
> diff --git a/test/T170-sexp.sh b/test/T170-sexp.sh
> index 800ebc6310e7..07113c0ad9a2 100755
> --- a/test/T170-sexp.sh
> +++ b/test/T170-sexp.sh
> @@ -5,16 +5,16 @@ test_description="--format=sexp output"
>  test_begin_subtest "Show message: sexp"
>  add_message "[subject]=\"sexp-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[bcc]=\"test_suite+bcc at notmuchmail.org\"" "[reply-to]=\"test_suite+replyto at notmuchmail.org\"" "[body]=\"sexp-show-message\""
>  output=$(notmuch show --format=sexp "sexp-show-message")
> -test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename \"${gen_msg_filename}\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :Bcc \"test_suite+bcc at notmuchmail.org\" :Reply-To \"test_suite+replyto at notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\"))) ())))"
> +test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :Bcc \"test_suite+bcc at notmuchmail.org\" :Reply-To \"test_suite+replyto at notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\"))) ())))"
>  
>  # This should be the same output as above.
>  test_begin_subtest "Show message: sexp --body=true"
>  output=$(notmuch show --format=sexp --body=true "sexp-show-message")
> -test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename \"${gen_msg_filename}\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :Bcc \"test_suite+bcc at notmuchmail.org\" :Reply-To \"test_suite+replyto at notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\"))) ())))"
> +test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :Bcc \"test_suite+bcc at notmuchmail.org\" :Reply-To \"test_suite+replyto at notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\"))) ())))"
>  
>  test_begin_subtest "Show message: sexp --body=false"
>  output=$(notmuch show --format=sexp --body=false "sexp-show-message")
> -test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename \"${gen_msg_filename}\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :Bcc \"test_suite+bcc at notmuchmail.org\" :Reply-To \"test_suite+replyto at notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\")) ())))"
> +test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :Bcc \"test_suite+bcc at notmuchmail.org\" :Reply-To \"test_suite+replyto at notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\")) ())))"
>  
>  test_begin_subtest "Search message: sexp"
>  add_message "[subject]=\"sexp-search-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"sexp-search-message\""
> @@ -24,7 +24,7 @@ test_expect_equal "$output" "((:thread \"0000000000000002\" :timestamp 946728000
>  test_begin_subtest "Show message: sexp, utf-8"
>  add_message "[subject]=\"sexp-show-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-show-méssage\""
>  output=$(notmuch show --format=sexp "jsön-show-méssage")
> -test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename \"${gen_msg_filename}\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-utf8-body-sübjéct\" :From \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"jsön-show-méssage\n\"))) ())))"
> +test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-utf8-body-sübjéct\" :From \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"jsön-show-méssage\n\"))) ())))"
>  
>  test_begin_subtest "Show message: sexp, inline attachment filename"
>  subject='sexp-show-inline-attachment-filename'
> @@ -39,7 +39,7 @@ output=$(notmuch show --format=sexp "id:$id")
>  filename=$(notmuch search --output=files "id:$id")
>  # Get length of README after base64-encoding, minus additional newline.
>  attachment_length=$(( $(base64 $TEST_DIRECTORY/README | wc -c) - 1 ))
> -test_expect_equal "$output" "((((:id \"$id\" :match t :excluded nil :filename \"$filename\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\") :headers (:Subject \"sexp-show-inline-attachment-filename\" :>From \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :To \"test_suite at notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"multipart/mixed\" :content ((:id 2 :content-type \"text/plain\" :content \"This is a test message with inline attachment with a filename\") (:id 3 :content-type \"application/octet-stream\" :filename \"README\" :content-transfer-encoding \"base64\" :content-length $attachment_length))))) ())))"
> +test_expect_equal "$output" "((((:id \"$id\" :match t :excluded nil :filename (\"$filename\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\") :headers (:Subject \"sexp-show-inline-attachment-filename\" :From \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :To \"test_suite at notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"multipart/mixed\" :content ((:id 2 :content-type \"text/plain\" :content \"This is a test message with inline attachment with a filename\") (:id 3 :content-type \"application/octet-stream\" :filename \"README\" :content-transfer-encoding \"base64\" :content-length $attachment_length))))) ())))"
>  
>  test_begin_subtest "Search message: sexp, utf-8"
>  add_message "[subject]=\"sexp-search-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-search-méssage\""
> diff --git a/test/T190-multipart.sh b/test/T190-multipart.sh
> index 35678909b0ce..18eb7b839ac0 100755
> --- a/test/T190-multipart.sh
> +++ b/test/T190-multipart.sh
> @@ -345,7 +345,7 @@ test_expect_success \
>  test_begin_subtest "--format=json --part=0, full message"
>  notmuch show --format=json --part=0 'id:87liy5ap00.fsf at yoom.home.cworth.org' >OUTPUT
>  cat <<EOF >EXPECTED
> -{"id": "87liy5ap00.fsf at yoom.home.cworth.org", "match": true, "excluded": false, "filename": "${MAIL_DIR}/multipart", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth <cworth at cworth.org>", "To": "cworth at cworth.org", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [
> +{"id": "87liy5ap00.fsf at yoom.home.cworth.org", "match": true, "excluded": false, "filename": ["${MAIL_DIR}/multipart"], "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth <cworth at cworth.org>", "To": "cworth at cworth.org", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [
>  {"id": 1, "content-type": "multipart/signed", "content": [
>  {"id": 2, "content-type": "multipart/mixed", "content": [
>  {"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"Subject": "html message", "From": "Carl Worth <cworth at cworth.org>", "To": "cworth at cworth.org", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [
> @@ -627,7 +627,7 @@ notmuch_json_show_sanitize <<EOF >EXPECTED
>   "original": {"id": "XXXXX",
>   "match": false,
>   "excluded": false,
> - "filename": "YYYYY",
> + "filename": ["YYYYY"],
>   "timestamp": 978709437,
>   "date_relative": "2001-01-05",
>   "tags": ["attachment","inbox","signed","unread"],
> @@ -715,7 +715,7 @@ cat_expected_head ()
>          cat <<EOF
>  [[[{"id": "htmlmessage", "match":true, "excluded": false, "date_relative":"2000-01-01",
>     "timestamp": 946684800,
> -   "filename": "${MAIL_DIR}/include-html",
> +   "filename": ["${MAIL_DIR}/include-html"],
>     "tags": ["inbox", "unread"],
>     "headers": { "Date": "Sat, 01 Jan 2000 00:00:00 +0000", "From": "A <a at example.com>",
>                  "Subject": "html message", "To": "B <b at example.com>"},
> diff --git a/test/T220-reply.sh b/test/T220-reply.sh
> index 818a86541496..17741e0d7a85 100755
> --- a/test/T220-reply.sh
> +++ b/test/T220-reply.sh
> @@ -229,7 +229,7 @@ test_expect_equal_json "$output" '
>          ],
>          "date_relative": "2010-01-05",
>          "excluded": false,
> -        "filename": "'${MAIL_DIR}'/msg-012",
> +        "filename": ["'${MAIL_DIR}'/msg-012"],
>          "headers": {
>              "Date": "Tue, 05 Jan 2010 15:43:56 +0000",
>              "From": "\u2603 <snowman at example.com>",
> diff --git a/test/T340-maildir-sync.sh b/test/T340-maildir-sync.sh
> index efeaa3f60d6e..b474bf46e4be 100755
> --- a/test/T340-maildir-sync.sh
> +++ b/test/T340-maildir-sync.sh
> @@ -39,7 +39,7 @@ output=$(notmuch show --format=json id:${gen_msg_id} | notmuch_json_show_sanitiz
>  test_expect_equal_json "$output" '[[[{"id": "XXXXX",
>  "match": true,
>  "excluded": false,
> -"filename": "YYYYY",
> +"filename": ["YYYYY"],
>  "timestamp": 42,
>  "date_relative": "2001-01-05",
>  "tags": ["inbox","replied"],
> diff --git a/test/T350-crypto.sh b/test/T350-crypto.sh
> index a1e5e206081f..14b215a3c0a6 100755
> --- a/test/T350-crypto.sh
> +++ b/test/T350-crypto.sh
> @@ -41,7 +41,7 @@ output=$(notmuch show --format=json --verify subject:"test signed message 001" \
>  expected='[[[{"id": "XXXXX",
>   "match": true,
>   "excluded": false,
> - "filename": "YYYYY",
> + "filename": ["YYYYY"],
>   "timestamp": 946728000,
>   "date_relative": "2000-01-01",
>   "tags": ["inbox","signed"],
> @@ -75,7 +75,7 @@ output=$(notmuch show --format=json --verify subject:"test signed message 001" \
>  expected='[[[{"id": "XXXXX",
>   "match": true,
>   "excluded": false,
> - "filename": "YYYYY",
> + "filename": ["YYYYY"],
>   "timestamp": 946728000,
>   "date_relative": "2000-01-01",
>   "tags": ["inbox","signed"],
> @@ -109,7 +109,7 @@ output=$(notmuch show --format=json --verify subject:"test signed message 001" \
>  expected='[[[{"id": "XXXXX",
>   "match": true,
>   "excluded": false,
> - "filename": "YYYYY",
> + "filename": ["YYYYY"],
>   "timestamp": 946728000,
>   "date_relative": "2000-01-01",
>   "tags": ["inbox","signed"],
> @@ -183,7 +183,7 @@ output=$(notmuch show --format=json --decrypt subject:"test encrypted message 00
>  expected='[[[{"id": "XXXXX",
>   "match": true,
>   "excluded": false,
> - "filename": "YYYYY",
> + "filename": ["YYYYY"],
>   "timestamp": 946728000,
>   "date_relative": "2000-01-01",
>   "tags": ["encrypted","inbox"],
> @@ -240,7 +240,7 @@ output=$(notmuch show --format=json --decrypt subject:"test encrypted message 00
>  expected='[[[{"id": "XXXXX",
>   "match": true,
>   "excluded": false,
> - "filename": "YYYYY",
> + "filename": ["YYYYY"],
>   "timestamp": 946728000,
>   "date_relative": "2000-01-01",
>   "tags": ["encrypted","inbox"],
> @@ -276,7 +276,7 @@ output=$(notmuch show --format=json --decrypt subject:"test encrypted message 00
>  expected='[[[{"id": "XXXXX",
>   "match": true,
>   "excluded": false,
> - "filename": "YYYYY",
> + "filename": ["YYYYY"],
>   "timestamp": 946728000,
>   "date_relative": "2000-01-01",
>   "tags": ["encrypted","inbox"],
> @@ -350,7 +350,7 @@ output=$(notmuch show --format=json --verify subject:"test signed message 001" \
>  expected='[[[{"id": "XXXXX",
>   "match": true,
>   "excluded": false,
> - "filename": "YYYYY",
> + "filename": ["YYYYY"],
>   "timestamp": 946728000,
>   "date_relative": "2000-01-01",
>   "tags": ["inbox","signed"],
> diff --git a/test/T355-smime.sh b/test/T355-smime.sh
> index a8be45e7098e..a6db4a18276f 100755
> --- a/test/T355-smime.sh
> +++ b/test/T355-smime.sh
> @@ -51,7 +51,7 @@ output=$(notmuch show --format=json --verify subject:"test signed message 001" \
>  expected='[[[{"id": "XXXXX",
>   "match": true,
>   "excluded": false,
> - "filename": "YYYYY",
> + "filename": ["YYYYY"],
>   "timestamp": 946728000,
>   "date_relative": "2000-01-01",
>   "tags": ["inbox","signed"],
> diff --git a/test/T470-missing-headers.sh b/test/T470-missing-headers.sh
> index 256a885f806a..32031e3174d3 100755
> --- a/test/T470-missing-headers.sh
> +++ b/test/T470-missing-headers.sh
> @@ -109,7 +109,7 @@ expected=$(notmuch_json_show_sanitize <<EOF
>                  ],
>                  "date_relative": "2001-01-05",
>                  "excluded": false,
> -                "filename": "YYYYY",
> +                "filename": ["YYYYY"],
>                  "headers": {
>                      "Date": "Fri, 05 Jan 2001 15:43:57 +0000",
>                      "From": "",
> @@ -139,7 +139,7 @@ expected=$(notmuch_json_show_sanitize <<EOF
>                  ],
>                  "date_relative": "1970-01-01",
>                  "excluded": false,
> -                "filename": "YYYYY",
> +                "filename": ["YYYYY"],
>                  "headers": {
>                      "Date": "Thu, 01 Jan 1970 00:00:00 +0000",
>                      "From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
> diff --git a/test/T510-thread-replies.sh b/test/T510-thread-replies.sh
> index 5ab066ac7baa..fa288bb19903 100755
> --- a/test/T510-thread-replies.sh
> +++ b/test/T510-thread-replies.sh
> @@ -21,7 +21,7 @@ output=$(notmuch show --format=json 'subject:one' | notmuch_json_show_sanitize)
>  expected='[[[{"id": "foo at one.com",
>   "match": true,
>   "excluded": false,
> - "filename": "YYYYY",
> + "filename": ["YYYYY"],
>   "timestamp": 978709437,
>   "date_relative": "2001-01-05",
>   "tags": ["inbox", "unread"],
> @@ -34,7 +34,7 @@ expected='[[[{"id": "foo at one.com",
>   "content": "This is just a test message (#1)\n"}]},
>   [[{"id": "msg-002 at notmuch-test-suite",
>   "match": true, "excluded": false,
> - "filename": "YYYYY",
> + "filename": ["YYYYY"],
>   "timestamp": 978709437, "date_relative": "2001-01-05",
>   "tags": ["inbox", "unread"], "headers": {"Subject": "Re: one",
>   "From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
> @@ -54,7 +54,7 @@ add_message '[in-reply-to]="<bar at baz.com>"' \
>  output=$(notmuch show --format=json 'subject:two' | notmuch_json_show_sanitize)
>  expected='[[[{"id": "foo at two.com",
>   "match": true, "excluded": false,
> - "filename": "YYYYY",
> + "filename": ["YYYYY"],
>   "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
>   "headers": {"Subject": "two",
>   "From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
> @@ -63,7 +63,7 @@ expected='[[[{"id": "foo at two.com",
>   "body": [{"id": 1, "content-type": "text/plain",
>   "content": "This is just a test message (#3)\n"}]},
>   [[{"id": "msg-004 at notmuch-test-suite", "match": true, "excluded": false,
> - "filename": "YYYYY",
> + "filename": ["YYYYY"],
>   "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
>   "headers": {"Subject": "Re: two",
>   "From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
> @@ -82,7 +82,7 @@ add_message '[in-reply-to]="<foo at three.com>"' \
>      '[subject]="Re: three"'
>  output=$(notmuch show --format=json 'subject:three' | notmuch_json_show_sanitize)
>  expected='[[[{"id": "foo at three.com", "match": true, "excluded": false,
> - "filename": "YYYYY",
> + "filename": ["YYYYY"],
>   "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
>   "headers": {"Subject": "three",
>   "From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
> @@ -90,7 +90,7 @@ expected='[[[{"id": "foo at three.com", "match": true, "excluded": false,
>   "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1,
>   "content-type": "text/plain", "content": "This is just a test message (#5)\n"}]},
>   [[{"id": "msg-006 at notmuch-test-suite", "match": true, "excluded": false,
> - "filename": "YYYYY",
> + "filename": ["YYYYY"],
>   "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
>   "headers": {"Subject": "Re: three",
>   "From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
> @@ -111,7 +111,7 @@ add_message '[in-reply-to]="<baz at four.com>"' \
>      '[subject]="neither"'
>  output=$(notmuch show --format=json 'subject:four' | notmuch_json_show_sanitize)
>  expected='[[[{"id": "foo at four.com", "match": true, "excluded": false,
> - "filename": "YYYYY",
> + "filename": ["YYYYY"],
>   "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
>   "headers": {"Subject": "four",
>   "From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
> @@ -119,7 +119,7 @@ expected='[[[{"id": "foo at four.com", "match": true, "excluded": false,
>   "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1,
>   "content-type": "text/plain", "content": "This is just a test message (#7)\n"}]},
>   [[{"id": "msg-009 at notmuch-test-suite", "match": false, "excluded": false,
> - "filename": "YYYYY",
> + "filename": ["YYYYY"],
>   "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
>   "headers": {"Subject": "neither",
>   "From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
> @@ -127,7 +127,7 @@ expected='[[[{"id": "foo at four.com", "match": true, "excluded": false,
>   "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1,
>   "content-type": "text/plain", "content": "This is just a test message (#9)\n"}]},
>   []]]]], [[{"id": "bar at four.com", "match": true, "excluded": false,
> - "filename": "YYYYY",
> + "filename": ["YYYYY"],
>   "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
>   "headers": {"Subject": "not-four",
>   "From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
> @@ -145,7 +145,7 @@ add_message '[id]="bar at five.com"' \
>      '[subject]="not-five"'
>  output=$(notmuch show --format=json 'subject:five' | notmuch_json_show_sanitize)
>  expected='[[[{"id": "XXXXX", "match": true, "excluded": false,
> - "filename": "YYYYY", "timestamp": 42, "date_relative": "2001-01-05",
> + "filename": ["YYYYY"], "timestamp": 42, "date_relative": "2001-01-05",
>   "tags": ["inbox", "unread"], "headers": {"Subject": "five",
>   "From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
>   "To": "Notmuch Test Suite <test_suite at notmuchmail.org>",
> @@ -153,7 +153,7 @@ expected='[[[{"id": "XXXXX", "match": true, "excluded": false,
>   "content-type": "text/plain",
>   "content": "This is just a test message (#10)\n"}]},
>   [[{"id": "XXXXX", "match": true, "excluded": false,
> - "filename": "YYYYY", "timestamp": 42, "date_relative": "2001-01-05",
> + "filename": ["YYYYY"], "timestamp": 42, "date_relative": "2001-01-05",
>   "tags": ["inbox", "unread"],
>   "headers": {"Subject": "not-five",
>   "From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
> diff --git a/test/test-lib.sh b/test/test-lib.sh
> index bb32e97b2af7..d8e159437ca9 100644
> --- a/test/test-lib.sh
> +++ b/test/test-lib.sh
> @@ -745,7 +745,7 @@ notmuch_json_show_sanitize ()
>  	-e 's|"id": "[^"]*",|"id": "XXXXX",|g' \
>  	-e 's|"Date": "Fri, 05 Jan 2001 [^"]*0000"|"Date": "GENERATED_DATE"|g' \
>  	-e 's|"filename": "signature.asc",||g' \
> -	-e 's|"filename": "/[^"]*",|"filename": "YYYYY",|g' \
> +	-e 's|"filename": \["/[^"]*"\],|"filename": \["YYYYY"\],|g' \
>  	-e 's|"timestamp": 97.......|"timestamp": 42|g' \
>          -e 's|"content-length": [1-9][0-9]*|"content-length": "NONZERO"|g'
>  }
> -- 
> 2.11.0
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list