1 Return-Path: <bremner@tesseract.cs.unb.ca>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by arlo.cworth.org (Postfix) with ESMTP id E3A326DE1B6F
\r
6 for <notmuch@notmuchmail.org>; Sun, 5 Apr 2015 16:02:46 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=0.536 tagged_above=-999 required=5 tests=[AWL=0.526,
\r
12 T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled
\r
13 Received: from arlo.cworth.org ([127.0.0.1])
\r
14 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id QTD1-lcWU3Wt for <notmuch@notmuchmail.org>;
\r
16 Sun, 5 Apr 2015 16:02:44 -0700 (PDT)
\r
17 Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net
\r
19 by arlo.cworth.org (Postfix) with ESMTPS id 3BACB6DE1B7C
\r
20 for <notmuch@notmuchmail.org>; Sun, 5 Apr 2015 16:02:44 -0700 (PDT)
\r
21 Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim
\r
22 4.80) (envelope-from <bremner@tesseract.cs.unb.ca>)
\r
23 id 1YetYI-0002pZ-I1; Sun, 05 Apr 2015 23:02:02 +0000
\r
24 Received: (nullmailer pid 2247 invoked by uid 1000); Sun, 05 Apr 2015
\r
26 From: David Bremner <david@tethera.net>
\r
27 To: notmuch@notmuchmail.org
\r
28 Subject: [WIP2 06/12] cli/show: add extra element to structured output for
\r
30 Date: Mon, 6 Apr 2015 07:59:08 +0900
\r
31 Message-Id: <1428274754-1698-7-git-send-email-david@tethera.net>
\r
32 X-Mailer: git-send-email 2.1.4
\r
33 In-Reply-To: <1428274754-1698-1-git-send-email-david@tethera.net>
\r
34 References: <1428274754-1698-1-git-send-email-david@tethera.net>
\r
36 Content-Type: text/plain; charset=UTF-8
\r
37 Content-Transfer-Encoding: 8bit
\r
38 X-BeenThere: notmuch@notmuchmail.org
\r
39 X-Mailman-Version: 2.1.18
\r
41 List-Id: "Use and development of the notmuch mail system."
\r
42 <notmuch.notmuchmail.org>
\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
44 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
46 List-Post: <mailto:notmuch@notmuchmail.org>
\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
49 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
50 X-List-Received-Date: Sun, 05 Apr 2015 23:02:47 -0000
\r
52 Initially this will contain the database uuid and last revision,
\r
53 and a query_type describing the remaining elements
\r
55 The changes to emacs/notmuch-tree.el and test/* are to (temporarily)
\r
56 force these to continue to use the old format.
\r
58 One non-trivial thing already tested is that the text and mbox formats
\r
59 do not change in format version 3.
\r
61 Makefile.local | 1 +
\r
62 devel/schemata | 14 ++++++++++++--
\r
63 emacs/notmuch-tree.el | 2 +-
\r
64 lib/notmuch.h | 6 ++++++
\r
65 lib/query.cc | 6 ++++++
\r
66 notmuch-client.h | 4 ++--
\r
67 notmuch-show.c | 4 ++--
\r
68 test/T070-insert.sh | 2 +-
\r
69 test/T160-json.sh | 10 +++++-----
\r
70 test/T170-sexp.sh | 10 +++++-----
\r
71 test/T190-multipart.sh | 4 ++--
\r
72 test/T340-maildir-sync.sh | 2 +-
\r
73 test/T350-crypto.sh | 14 +++++++-------
\r
74 test/T470-missing-headers.sh | 2 +-
\r
75 test/T510-thread-replies.sh | 10 +++++-----
\r
76 test/test-lib.sh | 4 ++++
\r
77 16 files changed, 61 insertions(+), 34 deletions(-)
\r
79 diff --git a/Makefile.local b/Makefile.local
\r
80 index 6d54742..8e17c13 100644
\r
81 --- a/Makefile.local
\r
82 +++ b/Makefile.local
\r
83 @@ -290,6 +290,7 @@ notmuch_client_srcs = \
\r
87 + sprinter-utils.c \
\r
91 diff --git a/devel/schemata b/devel/schemata
\r
92 index 98a1b2b..76dad01 100644
\r
93 --- a/devel/schemata
\r
94 +++ b/devel/schemata
\r
95 @@ -14,7 +14,7 @@ are interleaved. Keys are printed as keywords (symbols preceded by a
\r
96 colon), e.g. (:id "123" :time 54321 :from "foobar"). Null is printed as
\r
97 nil, true as t and false as nil.
\r
99 -This is version 2 of the structured output format.
\r
100 +This is version 3 of the structured output format.
\r
104 @@ -26,6 +26,9 @@ v1
\r
106 - Added the thread_summary.query field.
\r
109 +- Initial dictionary of database metadata to notmuch show output
\r
111 Common non-terminals
\r
112 --------------------
\r
114 @@ -38,12 +41,19 @@ threadid = string
\r
115 # Message ID, sans "id:"
\r
118 +database_metadata = {
\r
119 + query_type: string
\r
124 notmuch show schema
\r
125 -------------------
\r
127 # A top-level set of threads (do_show)
\r
128 # Returned by notmuch show without a --part argument
\r
129 -thread_set = [thread*]
\r
131 +thread_set = [database_metadata, thread*]
\r
133 # Top-level messages in a thread (show_messages)
\r
134 thread = [thread_node*]
\r
135 diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
\r
136 index 8b6cd51..ca5f9b6 100644
\r
137 --- a/emacs/notmuch-tree.el
\r
138 +++ b/emacs/notmuch-tree.el
\r
139 @@ -871,7 +871,7 @@ the same as for the function notmuch-tree."
\r
140 (notmuch-tag-clear-cache)
\r
141 (let ((proc (notmuch-start-notmuch
\r
142 "notmuch-tree" (current-buffer) #'notmuch-tree-process-sentinel
\r
143 - "show" "--body=false" "--format=sexp"
\r
144 + "show" "--body=false" "--format=sexp" "--format-version=2"
\r
145 message-arg search-args))
\r
146 ;; Use a scratch buffer to accumulate partial output.
\r
147 ;; This buffer will be killed by the sentinel, which
\r
148 diff --git a/lib/notmuch.h b/lib/notmuch.h
\r
149 index b6be727..5c17d97 100644
\r
150 --- a/lib/notmuch.h
\r
151 +++ b/lib/notmuch.h
\r
152 @@ -781,6 +781,12 @@ notmuch_sort_t
\r
153 notmuch_query_get_sort (notmuch_query_t *query);
\r
156 + * Return the associated notmuch database
\r
158 +notmuch_database_t *
\r
159 +notmuch_query_get_database (const notmuch_query_t *query);
\r
162 * Add a tag that will be excluded from the query results by default.
\r
163 * This exclusion will be overridden if this tag appears explicitly in
\r
165 diff --git a/lib/query.cc b/lib/query.cc
\r
166 index 9cedb6a..61f85c0 100644
\r
169 @@ -654,3 +654,9 @@ notmuch_query_count_threads (notmuch_query_t *query)
\r
174 +notmuch_database_t *
\r
175 +notmuch_query_get_database (const notmuch_query_t *query)
\r
177 + return query->notmuch;
\r
179 diff --git a/notmuch-client.h b/notmuch-client.h
\r
180 index ab0d188..76dbc38 100644
\r
181 --- a/notmuch-client.h
\r
182 +++ b/notmuch-client.h
\r
183 @@ -139,7 +139,7 @@ chomp_newline (char *str)
\r
184 * this. New (required) map fields can be added without increasing
\r
187 -#define NOTMUCH_FORMAT_CUR 2
\r
188 +#define NOTMUCH_FORMAT_CUR 3
\r
189 /* The minimum supported structured output format version. Requests
\r
190 * for format versions below this will return an error. */
\r
191 #define NOTMUCH_FORMAT_MIN 1
\r
192 @@ -148,7 +148,7 @@ chomp_newline (char *str)
\r
193 * Must be between NOTMUCH_FORMAT_MIN and NOTMUCH_FORMAT_CUR,
\r
196 -#define NOTMUCH_FORMAT_MIN_ACTIVE 1
\r
197 +#define NOTMUCH_FORMAT_MIN_ACTIVE 2
\r
199 /* The output format version requested by the caller on the command
\r
200 * line. If no format version is requested, this will be set to
\r
201 diff --git a/notmuch-show.c b/notmuch-show.c
\r
202 index b80933a..4489ea5 100644
\r
203 --- a/notmuch-show.c
\r
204 +++ b/notmuch-show.c
\r
205 @@ -1019,7 +1019,7 @@ do_show (void *ctx,
\r
209 - sp->begin_list (sp);
\r
210 + sprinter_start_output (sp, query, "threads");
\r
213 notmuch_threads_valid (threads);
\r
214 @@ -1041,7 +1041,7 @@ do_show (void *ctx,
\r
219 + sprinter_finish_output (sp);
\r
221 return res != NOTMUCH_STATUS_SUCCESS;
\r
223 diff --git a/test/T070-insert.sh b/test/T070-insert.sh
\r
224 index 168345c..48d36af 100755
\r
225 --- a/test/T070-insert.sh
\r
226 +++ b/test/T070-insert.sh
\r
227 @@ -38,7 +38,7 @@ cur_msg_filename=$(notmuch search --output=files "subject:insert-subject")
\r
228 test_expect_equal_file "$cur_msg_filename" "$gen_msg_filename"
\r
230 test_begin_subtest "Insert message adds default tags"
\r
231 -output=$(notmuch show --format=json "subject:insert-subject")
\r
232 +output=$(NOTMUCH_SHOW --format=json "subject:insert-subject")
\r
234 "id": "'"${gen_msg_id}"'",
\r
236 diff --git a/test/T160-json.sh b/test/T160-json.sh
\r
237 index c1cf649..46c1314 100755
\r
238 --- a/test/T160-json.sh
\r
239 +++ b/test/T160-json.sh
\r
240 @@ -4,16 +4,16 @@ test_description="--format=json output"
\r
242 test_begin_subtest "Show message: json"
\r
243 add_message "[subject]=\"json-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[bcc]=\"test_suite+bcc@notmuchmail.org\"" "[reply-to]=\"test_suite+replyto@notmuchmail.org\"" "[body]=\"json-show-message\""
\r
244 -output=$(notmuch show --format=json "json-show-message")
\r
245 +output=$(NOTMUCH_SHOW --format=json "json-show-message")
\r
246 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@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Bcc\": \"test_suite+bcc@notmuchmail.org\", \"Reply-To\": \"test_suite+replyto@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"
\r
248 # This should be the same output as above.
\r
249 test_begin_subtest "Show message: json --body=true"
\r
250 -output=$(notmuch show --format=json --body=true "json-show-message")
\r
251 +output=$(NOTMUCH_SHOW --format=json --body=true "json-show-message")
\r
252 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@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Bcc\": \"test_suite+bcc@notmuchmail.org\", \"Reply-To\": \"test_suite+replyto@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"
\r
254 test_begin_subtest "Show message: json --body=false"
\r
255 -output=$(notmuch show --format=json --body=false "json-show-message")
\r
256 +output=$(NOTMUCH_SHOW --format=json --body=false "json-show-message")
\r
257 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@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Bcc\": \"test_suite+bcc@notmuchmail.org\", \"Reply-To\": \"test_suite+replyto@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}}, []]]]"
\r
259 test_begin_subtest "Search message: json"
\r
260 @@ -32,7 +32,7 @@ test_expect_equal_json "$output" "[{\"thread\": \"XXX\",
\r
262 test_begin_subtest "Show message: json, utf-8"
\r
263 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\""
\r
264 -output=$(notmuch show --format=json "jsön-show-méssage")
\r
265 +output=$(NOTMUCH_SHOW --format=json "jsön-show-méssage")
\r
266 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@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@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\"}]}, []]]]"
\r
268 test_begin_subtest "Show message: json, inline attachment filename"
\r
269 @@ -44,7 +44,7 @@ emacs_fcc_message \
\r
270 "(mml-attach-file \"$TEST_DIRECTORY/README\" nil nil \"inline\")
\r
272 (insert \"Message-ID: <$id>\n\")"
\r
273 -output=$(notmuch show --format=json "id:$id")
\r
274 +output=$(NOTMUCH_SHOW --format=json "id:$id")
\r
275 filename=$(notmuch search --output=files "id:$id")
\r
276 # Get length of README after base64-encoding, minus additional newline.
\r
277 attachment_length=$(( $(base64 $TEST_DIRECTORY/README | wc -c) - 1 ))
\r
278 diff --git a/test/T170-sexp.sh b/test/T170-sexp.sh
\r
279 index 667e319..6c7402a 100755
\r
280 --- a/test/T170-sexp.sh
\r
281 +++ b/test/T170-sexp.sh
\r
282 @@ -4,16 +4,16 @@ test_description="--format=sexp output"
\r
284 test_begin_subtest "Show message: sexp"
\r
285 add_message "[subject]=\"sexp-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[bcc]=\"test_suite+bcc@notmuchmail.org\"" "[reply-to]=\"test_suite+replyto@notmuchmail.org\"" "[body]=\"sexp-show-message\""
\r
286 -output=$(notmuch show --format=sexp "sexp-show-message")
\r
287 +output=$(NOTMUCH_SHOW --format=sexp "sexp-show-message")
\r
288 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@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\"))) ())))"
\r
290 # This should be the same output as above.
\r
291 test_begin_subtest "Show message: sexp --body=true"
\r
292 -output=$(notmuch show --format=sexp --body=true "sexp-show-message")
\r
293 +output=$(NOTMUCH_SHOW --format=sexp --body=true "sexp-show-message")
\r
294 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@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\"))) ())))"
\r
296 test_begin_subtest "Show message: sexp --body=false"
\r
297 -output=$(notmuch show --format=sexp --body=false "sexp-show-message")
\r
298 +output=$(NOTMUCH_SHOW --format=sexp --body=false "sexp-show-message")
\r
299 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@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\")) ())))"
\r
301 test_begin_subtest "Search message: sexp"
\r
302 @@ -23,7 +23,7 @@ test_expect_equal "$output" "((:thread \"0000000000000002\" :timestamp 946728000
\r
304 test_begin_subtest "Show message: sexp, utf-8"
\r
305 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\""
\r
306 -output=$(notmuch show --format=sexp "jsön-show-méssage")
\r
307 +output=$(NOTMUCH_SHOW --format=sexp "jsön-show-méssage")
\r
308 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@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@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\"))) ())))"
\r
310 test_begin_subtest "Show message: sexp, inline attachment filename"
\r
311 @@ -35,7 +35,7 @@ emacs_fcc_message \
\r
312 "(mml-attach-file \"$TEST_DIRECTORY/README\" nil nil \"inline\")
\r
314 (insert \"Message-ID: <$id>\n\")"
\r
315 -output=$(notmuch show --format=sexp "id:$id")
\r
316 +output=$(NOTMUCH_SHOW --format=sexp "id:$id")
\r
317 filename=$(notmuch search --output=files "id:$id")
\r
318 # Get length of README after base64-encoding, minus additional newline.
\r
319 attachment_length=$(( $(base64 $TEST_DIRECTORY/README | wc -c) - 1 ))
\r
320 diff --git a/test/T190-multipart.sh b/test/T190-multipart.sh
\r
321 index ad8d29e..f8b805f 100755
\r
322 --- a/test/T190-multipart.sh
\r
323 +++ b/test/T190-multipart.sh
\r
324 @@ -744,11 +744,11 @@ cat <<EOF >> EXPECTED.withhtml
\r
327 test_begin_subtest "html parts excluded by default"
\r
328 -notmuch show --format=json id:htmlmessage > OUTPUT
\r
329 +NOTMUCH_SHOW --format=json id:htmlmessage > OUTPUT
\r
330 test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.nohtml)"
\r
332 test_begin_subtest "html parts included"
\r
333 -notmuch show --format=json --include-html id:htmlmessage > OUTPUT
\r
334 +NOTMUCH_SHOW --format=json --include-html id:htmlmessage > OUTPUT
\r
335 test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.withhtml)"
\r
337 test_begin_subtest "indexes mime-type #1"
\r
338 diff --git a/test/T340-maildir-sync.sh b/test/T340-maildir-sync.sh
\r
339 index 3186e70..50b1fb5 100755
\r
340 --- a/test/T340-maildir-sync.sh
\r
341 +++ b/test/T340-maildir-sync.sh
\r
342 @@ -35,7 +35,7 @@ output=$(cd ${MAIL_DIR}/cur; ls -1 adding-replied*)
\r
343 test_expect_equal "$output" "adding-replied-tag:2,RS"
\r
345 test_begin_subtest "notmuch show works with renamed file (without notmuch new)"
\r
346 -output=$(notmuch show --format=json id:${gen_msg_id} | notmuch_json_show_sanitize)
\r
347 +output=$(NOTMUCH_SHOW --format=json id:${gen_msg_id} | notmuch_json_show_sanitize)
\r
348 test_expect_equal_json "$output" '[[[{"id": "XXXXX",
\r
351 diff --git a/test/T350-crypto.sh b/test/T350-crypto.sh
\r
352 index 477b397..d9e02d0 100755
\r
353 --- a/test/T350-crypto.sh
\r
354 +++ b/test/T350-crypto.sh
\r
355 @@ -35,7 +35,7 @@ test_expect_success 'emacs delivery of signed message' \
\r
356 "(mml-secure-message-sign)"'
\r
358 test_begin_subtest "signature verification"
\r
359 -output=$(notmuch show --format=json --verify subject:"test signed message 001" \
\r
360 +output=$(NOTMUCH_SHOW --format=json --verify subject:"test signed message 001" \
\r
361 | notmuch_json_show_sanitize \
\r
362 | sed -e 's|"created": [1234567890]*|"created": 946728000|')
\r
363 expected='[[[{"id": "XXXXX",
\r
364 @@ -69,7 +69,7 @@ test_begin_subtest "signature verification with full owner trust"
\r
365 # give the key full owner trust
\r
366 echo "${FINGERPRINT}:6:" | gpg --no-tty --import-ownertrust >>"$GNUPGHOME"/trust.log 2>&1
\r
367 gpg --no-tty --check-trustdb >>"$GNUPGHOME"/trust.log 2>&1
\r
368 -output=$(notmuch show --format=json --verify subject:"test signed message 001" \
\r
369 +output=$(NOTMUCH_SHOW --format=json --verify subject:"test signed message 001" \
\r
370 | notmuch_json_show_sanitize \
\r
371 | sed -e 's|"created": [1234567890]*|"created": 946728000|')
\r
372 expected='[[[{"id": "XXXXX",
\r
373 @@ -103,7 +103,7 @@ test_expect_equal_json \
\r
374 test_begin_subtest "signature verification with signer key unavailable"
\r
375 # move the gnupghome temporarily out of the way
\r
376 mv "${GNUPGHOME}"{,.bak}
\r
377 -output=$(notmuch show --format=json --verify subject:"test signed message 001" \
\r
378 +output=$(NOTMUCH_SHOW --format=json --verify subject:"test signed message 001" \
\r
379 | notmuch_json_show_sanitize \
\r
380 | sed -e 's|"created": [1234567890]*|"created": 946728000|')
\r
381 expected='[[[{"id": "XXXXX",
\r
382 @@ -177,7 +177,7 @@ test_expect_equal \
\r
385 test_begin_subtest "decryption, --format=json"
\r
386 -output=$(notmuch show --format=json --decrypt subject:"test encrypted message 001" \
\r
387 +output=$(NOTMUCH_SHOW --format=json --decrypt subject:"test encrypted message 001" \
\r
388 | notmuch_json_show_sanitize \
\r
389 | sed -e 's|"created": [1234567890]*|"created": 946728000|')
\r
390 expected='[[[{"id": "XXXXX",
\r
391 @@ -235,7 +235,7 @@ test_expect_equal_file OUTPUT TESTATTACHMENT
\r
392 test_begin_subtest "decryption failure with missing key"
\r
393 mv "${GNUPGHOME}"{,.bak}
\r
394 # The length of the encrypted attachment varies so must be normalized.
\r
395 -output=$(notmuch show --format=json --decrypt subject:"test encrypted message 001" \
\r
396 +output=$(NOTMUCH_SHOW --format=json --decrypt subject:"test encrypted message 001" \
\r
397 | notmuch_json_show_sanitize \
\r
398 | sed -e 's|"created": [1234567890]*|"created": 946728000|' \
\r
399 | sed -e 's|"content-length": 6[1234567890]*|"content-length": 652|')
\r
400 @@ -272,7 +272,7 @@ test_expect_success 'emacs delivery of encrypted + signed message' \
\r
401 "(mml-secure-message-sign-encrypt)"'
\r
403 test_begin_subtest "decryption + signature verification"
\r
404 -output=$(notmuch show --format=json --decrypt subject:"test encrypted message 002" \
\r
405 +output=$(NOTMUCH_SHOW --format=json --decrypt subject:"test encrypted message 002" \
\r
406 | notmuch_json_show_sanitize \
\r
407 | sed -e 's|"created": [1234567890]*|"created": 946728000|')
\r
408 expected='[[[{"id": "XXXXX",
\r
409 @@ -327,7 +327,7 @@ y
\r
411 | gpg --no-tty --quiet --command-fd 0 --armor --gen-revoke "0x${FINGERPRINT}!" 2>/dev/null \
\r
412 | gpg --no-tty --quiet --import
\r
413 -output=$(notmuch show --format=json --verify subject:"test signed message 001" \
\r
414 +output=$(NOTMUCH_SHOW --format=json --verify subject:"test signed message 001" \
\r
415 | notmuch_json_show_sanitize \
\r
416 | sed -e 's|"created": [1234567890]*|"created": 946728000|')
\r
417 expected='[[[{"id": "XXXXX",
\r
418 diff --git a/test/T470-missing-headers.sh b/test/T470-missing-headers.sh
\r
419 index cb38301..c3ee430 100755
\r
420 --- a/test/T470-missing-headers.sh
\r
421 +++ b/test/T470-missing-headers.sh
\r
422 @@ -94,7 +94,7 @@ Body
\r
426 test_begin_subtest "Show: json"
\r
427 -output=$(notmuch show --format=json '*' | notmuch_json_show_sanitize)
\r
428 +output=$(NOTMUCH_SHOW --format=json '*' | notmuch_json_show_sanitize)
\r
429 expected=$(notmuch_json_show_sanitize <<EOF
\r
432 diff --git a/test/T510-thread-replies.sh b/test/T510-thread-replies.sh
\r
433 index 1392fbe..30ac39b 100755
\r
434 --- a/test/T510-thread-replies.sh
\r
435 +++ b/test/T510-thread-replies.sh
\r
436 @@ -17,7 +17,7 @@ add_message '[id]="foo@one.com"' \
\r
437 add_message '[in-reply-to]="mumble"' \
\r
438 '[references]="<foo@one.com>"' \
\r
439 '[subject]="Re: one"'
\r
440 -output=$(notmuch show --format=json 'subject:one' | notmuch_json_show_sanitize)
\r
441 +output=$(NOTMUCH_SHOW --format=json 'subject:one' | notmuch_json_show_sanitize)
\r
442 expected='[[[{"id": "foo@one.com",
\r
445 @@ -51,7 +51,7 @@ add_message '[id]="foo@two.com"' \
\r
446 add_message '[in-reply-to]="<bar@baz.com>"' \
\r
447 '[references]="<foo@two.com>"' \
\r
448 '[subject]="Re: two"'
\r
449 -output=$(notmuch show --format=json 'subject:two' | notmuch_json_show_sanitize)
\r
450 +output=$(NOTMUCH_SHOW --format=json 'subject:two' | notmuch_json_show_sanitize)
\r
451 expected='[[[{"id": "foo@two.com",
\r
452 "match": true, "excluded": false,
\r
453 "filename": "YYYYY",
\r
454 @@ -80,7 +80,7 @@ add_message '[id]="foo@three.com"' \
\r
455 '[subject]="three"'
\r
456 add_message '[in-reply-to]="<foo@three.com>"' \
\r
457 '[subject]="Re: three"'
\r
458 -output=$(notmuch show --format=json 'subject:three' | notmuch_json_show_sanitize)
\r
459 +output=$(NOTMUCH_SHOW --format=json 'subject:three' | notmuch_json_show_sanitize)
\r
460 expected='[[[{"id": "foo@three.com", "match": true, "excluded": false,
\r
461 "filename": "YYYYY",
\r
462 "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
\r
463 @@ -109,7 +109,7 @@ add_message '[id]="bar@four.com"' \
\r
464 add_message '[in-reply-to]="<baz@four.com>"' \
\r
465 '[references]="<baz@four.com> <foo@four.com>"' \
\r
466 '[subject]="neither"'
\r
467 -output=$(notmuch show --format=json 'subject:four' | notmuch_json_show_sanitize)
\r
468 +output=$(NOTMUCH_SHOW --format=json 'subject:four' | notmuch_json_show_sanitize)
\r
469 expected='[[[{"id": "foo@four.com", "match": true, "excluded": false,
\r
470 "filename": "YYYYY",
\r
471 "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
\r
472 @@ -143,7 +143,7 @@ add_message '[id]="foo@five.com"' \
\r
473 add_message '[id]="bar@five.com"' \
\r
474 '[references]="<foo@five.com> (garbage)"' \
\r
475 '[subject]="not-five"'
\r
476 -output=$(notmuch show --format=json 'subject:five' | notmuch_json_show_sanitize)
\r
477 +output=$(NOTMUCH_SHOW --format=json 'subject:five' | notmuch_json_show_sanitize)
\r
478 expected='[[[{"id": "XXXXX", "match": true, "excluded": false,
\r
479 "filename": "YYYYY", "timestamp": 42, "date_relative": "2001-01-05",
\r
480 "tags": ["inbox", "unread"], "headers": {"Subject": "five",
\r
481 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
482 index 486d1c4..d30608a 100644
\r
483 --- a/test/test-lib.sh
\r
484 +++ b/test/test-lib.sh
\r
485 @@ -669,6 +669,10 @@ NOTMUCH_NEW ()
\r
486 notmuch new "${@}" | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file'
\r
490 + notmuch show --format-version=2 "${@}"
\r
493 notmuch_search_sanitize ()
\r
495 perl -pe 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/'
\r