[PATCH 6/6] notmuch-restore: check for extra arguments.

David Bremner david at tethera.net
Fri Oct 21 12:47:57 PDT 2011


From: David Bremner <bremner at debian.org>

We consider it an error to pass more than one file to restore, since
extra ones are ignored.
---
 notmuch-restore.c |    7 +++++++
 test/dump-restore |    1 -
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/notmuch-restore.c b/notmuch-restore.c
index 097ca4b..c388c23 100644
--- a/notmuch-restore.c
+++ b/notmuch-restore.c
@@ -76,6 +76,13 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[])
 	optind++;
     }
 
+    if (optind < argc) {
+	fprintf (stderr,
+	 "Cannot read dump from more than one file: %s\n",
+		 argv[optind]);
+	return 1;
+    }
+
     /* Dump output is one line per message. We match a sequence of
      * non-space characters for the message-id, then one or more
      * spaces, then a list of space-separated tags as a sequence of
diff --git a/test/dump-restore b/test/dump-restore
index a6d6d65..d4b424e 100755
--- a/test/dump-restore
+++ b/test/dump-restore
@@ -50,7 +50,6 @@ test_expect_success 'Restore with nothing to do, III' \
   test_cmp dump.expected dump.actual'
 
 # notmuch restore currently only considers the first argument.
-test_subtest_known_broken
 test_expect_success 'Invalid restore invocation' \
   'test_must_fail notmuch restore dump.expected another_one'
 
-- 
1.7.5.4



More information about the notmuch mailing list