[PATCH 6/6] notmuch-restore: check for extra arguments.
[notmuch-archives.git] / 56 / 7d862f38ea35719693fb5d4f36107fdc0b6656
1 Return-Path: <bremner@pivot.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 olra.theworths.org (Postfix) with ESMTP id C9956431FB6\r
6         for <notmuch@notmuchmail.org>; Fri, 21 Oct 2011 12:48:12 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -2.3\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id v8icIaW+a5nd for <notmuch@notmuchmail.org>;\r
16         Fri, 21 Oct 2011 12:48:12 -0700 (PDT)\r
17 Received: from tempo.its.unb.ca (tempo.its.unb.ca [131.202.1.21])\r
18         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 5CB74429E27\r
21         for <notmuch@notmuchmail.org>; Fri, 21 Oct 2011 12:48:11 -0700 (PDT)\r
22 Received: from convex-new.cs.unb.ca ([131.202.13.154])\r
23         by tempo.its.unb.ca (8.13.8/8.13.8) with ESMTP id p9LJm40i002205;\r
24         Fri, 21 Oct 2011 16:48:07 -0300\r
25 Received: from bremner by convex-new.cs.unb.ca with local (Exim 4.72)\r
26         (envelope-from <bremner@pivot.cs.unb.ca>)\r
27         id 1RHL4W-00016c-TN; Fri, 21 Oct 2011 16:48:04 -0300\r
28 From: David Bremner <david@tethera.net>\r
29 To: notmuch@notmuchmail.org\r
30 Subject: [PATCH 6/6] notmuch-restore: check for extra arguments.\r
31 Date: Fri, 21 Oct 2011 16:47:57 -0300\r
32 Message-Id: <1319226477-4181-7-git-send-email-david@tethera.net>\r
33 X-Mailer: git-send-email 1.7.5.4\r
34 In-Reply-To: <1319226477-4181-1-git-send-email-david@tethera.net>\r
35 References: <1317317857-29636-1-git-send-email-thomas@schwinge.name>\r
36         <1319226477-4181-1-git-send-email-david@tethera.net>\r
37 Cc: David Bremner <bremner@debian.org>\r
38 X-BeenThere: notmuch@notmuchmail.org\r
39 X-Mailman-Version: 2.1.13\r
40 Precedence: list\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: Fri, 21 Oct 2011 19:48:13 -0000\r
51 \r
52 From: David Bremner <bremner@debian.org>\r
53 \r
54 We consider it an error to pass more than one file to restore, since\r
55 extra ones are ignored.\r
56 ---\r
57  notmuch-restore.c |    7 +++++++\r
58  test/dump-restore |    1 -\r
59  2 files changed, 7 insertions(+), 1 deletions(-)\r
60 \r
61 diff --git a/notmuch-restore.c b/notmuch-restore.c\r
62 index 097ca4b..c388c23 100644\r
63 --- a/notmuch-restore.c\r
64 +++ b/notmuch-restore.c\r
65 @@ -76,6 +76,13 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[])\r
66         optind++;\r
67      }\r
68  \r
69 +    if (optind < argc) {\r
70 +       fprintf (stderr,\r
71 +        "Cannot read dump from more than one file: %s\n",\r
72 +                argv[optind]);\r
73 +       return 1;\r
74 +    }\r
75 +\r
76      /* Dump output is one line per message. We match a sequence of\r
77       * non-space characters for the message-id, then one or more\r
78       * spaces, then a list of space-separated tags as a sequence of\r
79 diff --git a/test/dump-restore b/test/dump-restore\r
80 index a6d6d65..d4b424e 100755\r
81 --- a/test/dump-restore\r
82 +++ b/test/dump-restore\r
83 @@ -50,7 +50,6 @@ test_expect_success 'Restore with nothing to do, III' \\r
84    test_cmp dump.expected dump.actual'\r
85  \r
86  # notmuch restore currently only considers the first argument.\r
87 -test_subtest_known_broken\r
88  test_expect_success 'Invalid restore invocation' \\r
89    'test_must_fail notmuch restore dump.expected another_one'\r
90  \r
91 -- \r
92 1.7.5.4\r
93 \r