1 Return-Path: <jrollins@servo.finestructure.net>
\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 olra.theworths.org (Postfix) with ESMTP id 7705E429E30
\r
6 for <notmuch@notmuchmail.org>; Sat, 28 May 2011 14:52:24 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.921 tagged_above=-999 required=5
\r
12 tests=[NO_DNS_FOR_FROM=0.379, RCVD_IN_DNSWL_MED=-2.3]
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id oHP4-bdxzcLG for <notmuch@notmuchmail.org>;
\r
17 Sat, 28 May 2011 14:52:23 -0700 (PDT)
\r
18 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu
\r
20 by olra.theworths.org (Postfix) with ESMTP id 12104429E35
\r
21 for <notmuch@notmuchmail.org>; Sat, 28 May 2011 14:52:15 -0700 (PDT)
\r
22 Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])
\r
23 by fire-doxen-postvirus (Postfix) with ESMTP id 62B182E50EF0;
\r
24 Sat, 28 May 2011 14:45:47 -0700 (PDT)
\r
25 X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new
\r
26 Received: from servo.finestructure.net (cpe-98-149-172-122.socal.res.rr.com
\r
27 [98.149.172.122]) (Authenticated sender: jrollins)
\r
28 by fire-doxen-submit (Postfix) with ESMTP id BD582328121;
\r
29 Sat, 28 May 2011 14:45:42 -0700 (PDT)
\r
30 Received: by servo.finestructure.net (Postfix, from userid 1000)
\r
31 id 2465578A; Sat, 28 May 2011 14:52:05 -0700 (PDT)
\r
32 From: Jameson Graef Rollins <jrollins@finestructure.net>
\r
33 To: Notmuch Mail <notmuch@notmuchmail.org>
\r
34 Subject: [PATCH 05/25] fix trailing newlines in notmuch search
\r
35 Date: Sat, 28 May 2011 14:51:40 -0700
\r
36 Message-Id: <1306619520-25730-6-git-send-email-jrollins@finestructure.net>
\r
37 X-Mailer: git-send-email 1.7.4.4
\r
38 In-Reply-To: <1306619520-25730-5-git-send-email-jrollins@finestructure.net>
\r
39 References: <1306619520-25730-1-git-send-email-jrollins@finestructure.net>
\r
40 <1306619520-25730-2-git-send-email-jrollins@finestructure.net>
\r
41 <1306619520-25730-3-git-send-email-jrollins@finestructure.net>
\r
42 <1306619520-25730-4-git-send-email-jrollins@finestructure.net>
\r
43 <1306619520-25730-5-git-send-email-jrollins@finestructure.net>
\r
44 X-BeenThere: notmuch@notmuchmail.org
\r
45 X-Mailman-Version: 2.1.13
\r
47 List-Id: "Use and development of the notmuch mail system."
\r
48 <notmuch.notmuchmail.org>
\r
49 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
51 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
52 List-Post: <mailto:notmuch@notmuchmail.org>
\r
53 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
54 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
56 X-List-Received-Date: Sat, 28 May 2011 21:52:24 -0000
\r
58 A previous commit to fix json formatting for null results
\r
59 (0b1ddc5f6652bde99d63d9d553777b3d926694cf) accidentally introduced a
\r
60 regression that removed trailing newlines for non-json output. (There
\r
61 wasn't a good test for this previously, but there is now). The
\r
62 problem is due to the fundamental differences in formatting between
\r
63 the json and non-json outputs. The only way to fix this was to add a
\r
64 new formatting field that represents the string to output at the end
\r
67 All output formatting tests should pass now.
\r
69 notmuch-search.c | 18 +++++++++++++++---
\r
70 1 files changed, 15 insertions(+), 3 deletions(-)
\r
72 diff --git a/notmuch-search.c b/notmuch-search.c
\r
73 index 8b90121..69af617 100644
\r
74 --- a/notmuch-search.c
\r
75 +++ b/notmuch-search.c
\r
76 @@ -48,6 +48,7 @@ typedef struct search_format {
\r
77 const char *item_sep;
\r
78 const char *item_end;
\r
79 const char *results_end;
\r
80 + const char *results_null;
\r
84 @@ -72,6 +73,7 @@ static const search_format_t format_text = {
\r
92 @@ -98,6 +100,7 @@ static const search_format_t format_json = {
\r
100 @@ -236,7 +239,10 @@ do_search_threads (const search_format_t *format,
\r
101 notmuch_thread_destroy (thread);
\r
104 - fputs (format->results_end, stdout);
\r
105 + if (first_thread)
\r
106 + fputs (format->results_null, stdout);
\r
108 + fputs (format->results_end, stdout);
\r
112 @@ -280,7 +286,10 @@ do_search_messages (const search_format_t *format,
\r
114 notmuch_messages_destroy (messages);
\r
116 - fputs (format->results_end, stdout);
\r
117 + if (first_message)
\r
118 + fputs (format->results_null, stdout);
\r
120 + fputs (format->results_end, stdout);
\r
124 @@ -329,7 +338,10 @@ do_search_tags (notmuch_database_t *notmuch,
\r
126 notmuch_messages_destroy (messages);
\r
128 - fputs (format->results_end, stdout);
\r
130 + fputs (format->results_null, stdout);
\r
132 + fputs (format->results_end, stdout);
\r