]> git.cworth.org Git - notmuch/commitdiff
notmuch-restore: check for extra arguments.
authorDavid Bremner <bremner@debian.org>
Fri, 21 Oct 2011 18:46:54 +0000 (15:46 -0300)
committerDavid Bremner <bremner@debian.org>
Sun, 23 Oct 2011 13:27:57 +0000 (10:27 -0300)
We consider it an error to pass more than one file to restore, since
extra ones are ignored.

notmuch-restore.c
test/dump-restore

index 75bc09a68629da667fb8e3a62257ba028c6fc431..ff1ebab10d758b963a4774f91e89a43c6be3c50f 100644 (file)
@@ -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
index 85096716ba3753a09ddecf8e3e01ddcb0a32d1ac..439e99808af5721c0042e4e9b7ede85cb0b9170a 100755 (executable)
@@ -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'