From: David Bremner <bremner@debian.org>
Date: Fri, 21 Oct 2011 18:46:54 +0000 (-0300)
Subject: notmuch-restore: check for extra arguments.
X-Git-Tag: 0.10_rc1~68
X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=903fe6398693621484315d30bd8d37de4095f4a5;p=notmuch.git

notmuch-restore: check for extra arguments.

We consider it an error to pass more than one file to restore, since
extra ones are ignored.
---

diff --git a/notmuch-restore.c b/notmuch-restore.c
index 75bc09a6..ff1ebab1 100644
--- a/notmuch-restore.c
+++ b/notmuch-restore.c
@@ -77,6 +77,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 85096716..439e9980 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'