1 Return-Path: <too@guru-group.fi>
\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 3E7676DE0217
\r
6 for <notmuch@notmuchmail.org>; Sat, 7 May 2016 12:24:29 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=0.265 tagged_above=-999 required=5 tests=[AWL=0.274,
\r
12 HEADER_FROM_DIFFERENT_DOMAINS=0.001, T_RP_MATCHES_RCVD=-0.01]
\r
14 Received: from arlo.cworth.org ([127.0.0.1])
\r
15 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id skPLeK_ClONd for <notmuch@notmuchmail.org>;
\r
17 Sat, 7 May 2016 12:24:21 -0700 (PDT)
\r
18 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])
\r
19 by arlo.cworth.org (Postfix) with ESMTP id 5DF3C6DE00EB
\r
20 for <notmuch@notmuchmail.org>; Sat, 7 May 2016 12:24:21 -0700 (PDT)
\r
21 Received: by guru.guru-group.fi (Postfix, from userid 501)
\r
22 id 492F0100227; Sat, 7 May 2016 22:24:20 +0300 (EEST)
\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
24 To: notmuch@notmuchmail.org
\r
25 Cc: tomi.ollila@iki.fi
\r
26 Subject: [PATCH] cli: tell how many messages were precisely matched when
\r
28 Date: Sat, 7 May 2016 22:24:18 +0300
\r
29 Message-Id: <1462649058-5330-1-git-send-email-tomi.ollila@iki.fi>
\r
30 X-Mailer: git-send-email 2.6.4
\r
31 X-BeenThere: notmuch@notmuchmail.org
\r
32 X-Mailman-Version: 2.1.20
\r
34 List-Id: "Use and development of the notmuch mail system."
\r
35 <notmuch.notmuchmail.org>
\r
36 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,
\r
37 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
38 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
39 List-Post: <mailto:notmuch@notmuchmail.org>
\r
40 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
41 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,
\r
42 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
43 X-List-Received-Date: Sat, 07 May 2016 19:24:29 -0000
\r
45 In case of notmuch reply and notmuch show --part=N it is required that
\r
46 search terms match to one message. If match count was != 1, error
\r
47 message "Error: search term did not match precisely one message"
\r
48 was too vague to explain what happened.
\r
50 By appending (matched <num> messages) to the error message it
\r
51 makes the problem more understandable (e.g when <num> is '0'
\r
52 user reckons the query had a typo in it).
\r
54 notmuch-reply.c | 2 +-
\r
55 notmuch-show.c | 2 +-
\r
56 test/T210-raw.sh | 2 +-
\r
57 3 files changed, 3 insertions(+), 3 deletions(-)
\r
59 diff --git a/notmuch-reply.c b/notmuch-reply.c
\r
60 index 3c6d685cbd60..a74194a31e4f 100644
\r
61 --- a/notmuch-reply.c
\r
62 +++ b/notmuch-reply.c
\r
63 @@ -664,7 +664,7 @@ notmuch_reply_format_sprinter(void *ctx,
\r
67 - fprintf (stderr, "Error: search term did not match precisely one message.\n");
\r
68 + fprintf (stderr, "Error: search term did not match precisely one message (matched %d messages).\n", count);
\r
72 diff --git a/notmuch-show.c b/notmuch-show.c
\r
73 index 87e52bbc0e81..3d5033d644b3 100644
\r
74 --- a/notmuch-show.c
\r
75 +++ b/notmuch-show.c
\r
76 @@ -904,7 +904,7 @@ do_show_single (void *ctx,
\r
80 - fprintf (stderr, "Error: search term did not match precisely one message.\n");
\r
81 + fprintf (stderr, "Error: search term did not match precisely one message (matched %d messages).\n", count);
\r
85 diff --git a/test/T210-raw.sh b/test/T210-raw.sh
\r
86 index dfea2d19caa9..832a4ad311b7 100755
\r
87 --- a/test/T210-raw.sh
\r
88 +++ b/test/T210-raw.sh
\r
89 @@ -8,7 +8,7 @@ add_message
\r
91 test_begin_subtest "Attempt to show multiple raw messages"
\r
92 output=$(notmuch show --format=raw "*" 2>&1)
\r
93 -test_expect_equal "$output" "Error: search term did not match precisely one message."
\r
94 +test_expect_equal "$output" "Error: search term did not match precisely one message (matched 2 messages)."
\r
96 test_begin_subtest "Show a raw message"
\r
97 output=$(notmuch show --format=raw id:msg-001@notmuch-test-suite | notmuch_date_sanitize)
\r