From 7400e18fb5f532524146f7083bf964c7e501bdc8 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Tue, 27 Mar 2012 00:04:11 +0300 Subject: cli: refactor "notmuch restore" message tagging into a separate function Refactor to make tagging code easier to reuse in the future. No functional changes. Signed-off-by: Jani Nikula --- notmuch-restore.c | 148 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 78 insertions(+), 70 deletions(-) (limited to 'notmuch-restore.c') diff --git a/notmuch-restore.c b/notmuch-restore.c index 87d9772..d3b9246 100644 --- a/notmuch-restore.c +++ b/notmuch-restore.c @@ -20,6 +20,81 @@ #include "notmuch-client.h" +static int +tag_message (notmuch_database_t *notmuch, const char *message_id, + char *file_tags, notmuch_bool_t remove_all, + notmuch_bool_t synchronize_flags) +{ + notmuch_status_t status; + notmuch_tags_t *db_tags; + char *db_tags_str; + notmuch_message_t *message = NULL; + const char *tag; + char *next; + int ret = 0; + + status = notmuch_database_find_message (notmuch, message_id, &message); + if (status || message == NULL) { + fprintf (stderr, "Warning: Cannot apply tags to %smessage: %s\n", + message ? "" : "missing ", message_id); + if (status) + fprintf (stderr, "%s\n", notmuch_status_to_string(status)); + return 1; + } + + /* In order to detect missing messages, this check/optimization is + * intentionally done *after* first finding the message. */ + if (!remove_all && (file_tags == NULL || *file_tags == '\0')) + goto DONE; + + db_tags_str = NULL; + for (db_tags = notmuch_message_get_tags (message); + notmuch_tags_valid (db_tags); + notmuch_tags_move_to_next (db_tags)) { + tag = notmuch_tags_get (db_tags); + + if (db_tags_str) + db_tags_str = talloc_asprintf_append (db_tags_str, " %s", tag); + else + db_tags_str = talloc_strdup (message, tag); + } + + if (((file_tags == NULL || *file_tags == '\0') && + (db_tags_str == NULL || *db_tags_str == '\0')) || + (file_tags && db_tags_str && strcmp (file_tags, db_tags_str) == 0)) + goto DONE; + + notmuch_message_freeze (message); + + if (remove_all) + notmuch_message_remove_all_tags (message); + + next = file_tags; + while (next) { + tag = strsep (&next, " "); + if (*tag == '\0') + continue; + status = notmuch_message_add_tag (message, tag); + if (status) { + fprintf (stderr, "Error applying tag %s to message %s:\n", + tag, message_id); + fprintf (stderr, "%s\n", notmuch_status_to_string (status)); + ret = 1; + } + } + + notmuch_message_thaw (message); + + if (synchronize_flags) + notmuch_message_tags_to_maildir_flags (message); + +DONE: + if (message) + notmuch_message_destroy (message); + + return ret; +} + int notmuch_restore_command (unused (void *ctx), int argc, char *argv[]) { @@ -88,11 +163,7 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[]) while ((line_len = getline (&line, &line_size, input)) != -1) { regmatch_t match[3]; - char *message_id, *file_tags, *tag, *next; - notmuch_message_t *message = NULL; - notmuch_status_t status; - notmuch_tags_t *db_tags; - char *db_tags_str; + char *message_id, *file_tags; chomp_newline (line); @@ -109,72 +180,9 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[]) file_tags = xstrndup (line + match[2].rm_so, match[2].rm_eo - match[2].rm_so); - status = notmuch_database_find_message (notmuch, message_id, &message); - if (status || message == NULL) { - fprintf (stderr, "Warning: Cannot apply tags to %smessage: %s\n", - message ? "" : "missing ", message_id); - if (status) - fprintf (stderr, "%s\n", - notmuch_status_to_string(status)); - goto NEXT_LINE; - } - - /* In order to detect missing messages, this check/optimization is - * intentionally done *after* first finding the message. */ - if (accumulate && (file_tags == NULL || *file_tags == '\0')) - { - goto NEXT_LINE; - } - - db_tags_str = NULL; - for (db_tags = notmuch_message_get_tags (message); - notmuch_tags_valid (db_tags); - notmuch_tags_move_to_next (db_tags)) - { - const char *tag = notmuch_tags_get (db_tags); - - if (db_tags_str) - db_tags_str = talloc_asprintf_append (db_tags_str, " %s", tag); - else - db_tags_str = talloc_strdup (message, tag); - } - - if (((file_tags == NULL || *file_tags == '\0') && - (db_tags_str == NULL || *db_tags_str == '\0')) || - (file_tags && db_tags_str && strcmp (file_tags, db_tags_str) == 0)) - { - goto NEXT_LINE; - } - - notmuch_message_freeze (message); - - if (!accumulate) - notmuch_message_remove_all_tags (message); - - next = file_tags; - while (next) { - tag = strsep (&next, " "); - if (*tag == '\0') - continue; - status = notmuch_message_add_tag (message, tag); - if (status) { - fprintf (stderr, - "Error applying tag %s to message %s:\n", - tag, message_id); - fprintf (stderr, "%s\n", - notmuch_status_to_string (status)); - } - } - - notmuch_message_thaw (message); - - if (synchronize_flags) - notmuch_message_tags_to_maildir_flags (message); + tag_message (notmuch, message_id, file_tags, !accumulate, + synchronize_flags); - NEXT_LINE: - if (message) - notmuch_message_destroy (message); - message = NULL; free (message_id); free (file_tags); } -- cgit v1.2.3 From 6f7469f54744656f90ce215f365d5731e16acd3c Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Sun, 22 Apr 2012 14:07:53 +0200 Subject: Use notmuch_database_destroy instead of notmuch_database_close Adapt the notmuch binaries source to the notmuch_database_close split. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de> --- notmuch-count.c | 2 +- notmuch-dump.c | 2 +- notmuch-new.c | 2 +- notmuch-reply.c | 2 +- notmuch-restore.c | 2 +- notmuch-search.c | 2 +- notmuch-show.c | 2 +- notmuch-tag.c | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) (limited to 'notmuch-restore.c') diff --git a/notmuch-count.c b/notmuch-count.c index b76690c..9c2ad7b 100644 --- a/notmuch-count.c +++ b/notmuch-count.c @@ -107,7 +107,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[]) } notmuch_query_destroy (query); - notmuch_database_close (notmuch); + notmuch_database_destroy (notmuch); return 0; } diff --git a/notmuch-dump.c b/notmuch-dump.c index a735875..71ab0ea 100644 --- a/notmuch-dump.c +++ b/notmuch-dump.c @@ -116,7 +116,7 @@ notmuch_dump_command (unused (void *ctx), int argc, char *argv[]) fclose (output); notmuch_query_destroy (query); - notmuch_database_close (notmuch); + notmuch_database_destroy (notmuch); return 0; } diff --git a/notmuch-new.c b/notmuch-new.c index 473201e..3ff6304 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -1041,7 +1041,7 @@ notmuch_new_command (void *ctx, int argc, char *argv[]) fprintf (stderr, "Note: A fatal error was encountered: %s\n", notmuch_status_to_string (ret)); - notmuch_database_close (notmuch); + notmuch_database_destroy (notmuch); if (run_hooks && !ret && !interrupted) ret = notmuch_run_hook (db_path, "post-new"); diff --git a/notmuch-reply.c b/notmuch-reply.c index 0949d9f..da99a13 100644 --- a/notmuch-reply.c +++ b/notmuch-reply.c @@ -755,7 +755,7 @@ notmuch_reply_command (void *ctx, int argc, char *argv[]) return 1; notmuch_query_destroy (query); - notmuch_database_close (notmuch); + notmuch_database_destroy (notmuch); if (params.cryptoctx) g_object_unref(params.cryptoctx); diff --git a/notmuch-restore.c b/notmuch-restore.c index d3b9246..02b563c 100644 --- a/notmuch-restore.c +++ b/notmuch-restore.c @@ -192,7 +192,7 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[]) if (line) free (line); - notmuch_database_close (notmuch); + notmuch_database_destroy (notmuch); if (input != stdin) fclose (input); diff --git a/notmuch-search.c b/notmuch-search.c index 1cc8430..7dfd270 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -545,7 +545,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) } notmuch_query_destroy (query); - notmuch_database_close (notmuch); + notmuch_database_destroy (notmuch); return ret; } diff --git a/notmuch-show.c b/notmuch-show.c index da4a797..3b6667c 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -1117,7 +1117,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[])) } notmuch_query_destroy (query); - notmuch_database_close (notmuch); + notmuch_database_destroy (notmuch); if (params.cryptoctx) g_object_unref(params.cryptoctx); diff --git a/notmuch-tag.c b/notmuch-tag.c index 05feed3..bd56fd1 100644 --- a/notmuch-tag.c +++ b/notmuch-tag.c @@ -238,7 +238,7 @@ notmuch_tag_command (void *ctx, int argc, char *argv[]) ret = tag_query (ctx, notmuch, query_string, tag_ops, synchronize_flags); - notmuch_database_close (notmuch); + notmuch_database_destroy (notmuch); return ret; } -- cgit v1.2.3 From 5fddc07dc31481453c1af186bf7da241c00cdbf1 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Mon, 30 Apr 2012 12:25:33 -0400 Subject: lib/cli: Make notmuch_database_open return a status code It has been a long-standing issue that notmuch_database_open doesn't return any indication of why it failed. This patch changes its prototype to return a notmuch_status_t and set an out-argument to the database itself, like other functions that return both a status and an object. In the interest of atomicity, this also updates every use in the CLI so that notmuch still compiles. Since this patch does not update the bindings, the Python bindings test fails. --- lib/database.cc | 28 +++++++++++++++++++++++----- lib/notmuch.h | 26 +++++++++++++++++++------- notmuch-count.c | 5 ++--- notmuch-dump.c | 5 ++--- notmuch-new.c | 5 ++--- notmuch-reply.c | 5 ++--- notmuch-restore.c | 5 ++--- notmuch-search.c | 5 ++--- notmuch-show.c | 5 ++--- notmuch-tag.c | 5 ++--- test/symbol-test.cc | 3 ++- 11 files changed, 60 insertions(+), 37 deletions(-) (limited to 'notmuch-restore.c') diff --git a/lib/database.cc b/lib/database.cc index 2fefcad..1e66599 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -556,8 +556,9 @@ notmuch_database_create (const char *path) goto DONE; } - notmuch = notmuch_database_open (path, - NOTMUCH_DATABASE_MODE_READ_WRITE); + notmuch_database_open (path, + NOTMUCH_DATABASE_MODE_READ_WRITE, + ¬much); notmuch_database_upgrade (notmuch, NULL, NULL); DONE: @@ -578,10 +579,12 @@ _notmuch_database_ensure_writable (notmuch_database_t *notmuch) return NOTMUCH_STATUS_SUCCESS; } -notmuch_database_t * +notmuch_status_t notmuch_database_open (const char *path, - notmuch_database_mode_t mode) + notmuch_database_mode_t mode, + notmuch_database_t **database) { + notmuch_status_t status = NOTMUCH_STATUS_SUCCESS; void *local = talloc_new (NULL); notmuch_database_t *notmuch = NULL; char *notmuch_path, *xapian_path; @@ -590,8 +593,15 @@ notmuch_database_open (const char *path, unsigned int i, version; static int initialized = 0; + if (path == NULL) { + fprintf (stderr, "Error: Cannot open a database for a NULL path.\n"); + status = NOTMUCH_STATUS_NULL_POINTER; + goto DONE; + } + if (! (notmuch_path = talloc_asprintf (local, "%s/%s", path, ".notmuch"))) { fprintf (stderr, "Out of memory\n"); + status = NOTMUCH_STATUS_OUT_OF_MEMORY; goto DONE; } @@ -599,11 +609,13 @@ notmuch_database_open (const char *path, if (err) { fprintf (stderr, "Error opening database at %s: %s\n", notmuch_path, strerror (errno)); + status = NOTMUCH_STATUS_FILE_ERROR; goto DONE; } if (! (xapian_path = talloc_asprintf (local, "%s/%s", notmuch_path, "xapian"))) { fprintf (stderr, "Out of memory\n"); + status = NOTMUCH_STATUS_OUT_OF_MEMORY; goto DONE; } @@ -644,6 +656,7 @@ notmuch_database_open (const char *path, notmuch->mode = NOTMUCH_DATABASE_MODE_READ_ONLY; notmuch_database_destroy (notmuch); notmuch = NULL; + status = NOTMUCH_STATUS_FILE_ERROR; goto DONE; } @@ -704,12 +717,17 @@ notmuch_database_open (const char *path, error.get_msg().c_str()); notmuch_database_destroy (notmuch); notmuch = NULL; + status = NOTMUCH_STATUS_XAPIAN_EXCEPTION; } DONE: talloc_free (local); - return notmuch; + if (database) + *database = notmuch; + else + talloc_free (notmuch); + return status; } void diff --git a/lib/notmuch.h b/lib/notmuch.h index 7d9e092..44b0c46 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -151,9 +151,6 @@ typedef enum { NOTMUCH_DATABASE_MODE_READ_WRITE } notmuch_database_mode_t; -/* XXX: I think I'd like this to take an extra argument of - * notmuch_status_t* for returning a status value on failure. */ - /* Open an existing notmuch database located at 'path'. * * The database should have been created at some time in the past, @@ -168,12 +165,27 @@ typedef enum { * The caller should call notmuch_database_destroy when finished with * this database. * - * In case of any failure, this function returns NULL, (after printing - * an error message on stderr). + * In case of any failure, this function returns an error status and + * sets *database to NULL (after printing an error message on stderr). + * + * Return value: + * + * NOTMUCH_STATUS_SUCCESS: Successfully opened the database. + * + * NOTMUCH_STATUS_NULL_POINTER: The given 'path' argument is NULL. + * + * NOTMUCH_STATUS_OUT_OF_MEMORY: Out of memory. + * + * NOTMUCH_STATUS_FILE_ERROR: An error occurred trying to open the + * database file (such as permission denied, or file not found, + * etc.), or the database version is unknown. + * + * NOTMUCH_STATUS_XAPIAN_EXCEPTION: A Xapian exception occurred. */ -notmuch_database_t * +notmuch_status_t notmuch_database_open (const char *path, - notmuch_database_mode_t mode); + notmuch_database_mode_t mode, + notmuch_database_t **database); /* Close the given notmuch database. * diff --git a/notmuch-count.c b/notmuch-count.c index 9c2ad7b..2f98128 100644 --- a/notmuch-count.c +++ b/notmuch-count.c @@ -66,9 +66,8 @@ notmuch_count_command (void *ctx, int argc, char *argv[]) if (config == NULL) return 1; - notmuch = notmuch_database_open (notmuch_config_get_database_path (config), - NOTMUCH_DATABASE_MODE_READ_ONLY); - if (notmuch == NULL) + if (notmuch_database_open (notmuch_config_get_database_path (config), + NOTMUCH_DATABASE_MODE_READ_ONLY, ¬much)) return 1; query_str = query_string_from_args (ctx, argc-opt_index, argv+opt_index); diff --git a/notmuch-dump.c b/notmuch-dump.c index 71ab0ea..3743214 100644 --- a/notmuch-dump.c +++ b/notmuch-dump.c @@ -36,9 +36,8 @@ notmuch_dump_command (unused (void *ctx), int argc, char *argv[]) if (config == NULL) return 1; - notmuch = notmuch_database_open (notmuch_config_get_database_path (config), - NOTMUCH_DATABASE_MODE_READ_ONLY); - if (notmuch == NULL) + if (notmuch_database_open (notmuch_config_get_database_path (config), + NOTMUCH_DATABASE_MODE_READ_ONLY, ¬much)) return 1; char *output_file_name = NULL; diff --git a/notmuch-new.c b/notmuch-new.c index 3ff6304..7788743 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -903,9 +903,8 @@ notmuch_new_command (void *ctx, int argc, char *argv[]) notmuch = notmuch_database_create (db_path); add_files_state.total_files = count; } else { - notmuch = notmuch_database_open (db_path, - NOTMUCH_DATABASE_MODE_READ_WRITE); - if (notmuch == NULL) + if (notmuch_database_open (db_path, NOTMUCH_DATABASE_MODE_READ_WRITE, + ¬much)) return 1; if (notmuch_database_needs_upgrade (notmuch)) { diff --git a/notmuch-reply.c b/notmuch-reply.c index da99a13..7184a5d 100644 --- a/notmuch-reply.c +++ b/notmuch-reply.c @@ -740,9 +740,8 @@ notmuch_reply_command (void *ctx, int argc, char *argv[]) return 1; } - notmuch = notmuch_database_open (notmuch_config_get_database_path (config), - NOTMUCH_DATABASE_MODE_READ_ONLY); - if (notmuch == NULL) + if (notmuch_database_open (notmuch_config_get_database_path (config), + NOTMUCH_DATABASE_MODE_READ_ONLY, ¬much)) return 1; query = notmuch_query_create (notmuch, query_string); diff --git a/notmuch-restore.c b/notmuch-restore.c index 02b563c..4f4096e 100644 --- a/notmuch-restore.c +++ b/notmuch-restore.c @@ -115,9 +115,8 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[]) if (config == NULL) return 1; - notmuch = notmuch_database_open (notmuch_config_get_database_path (config), - NOTMUCH_DATABASE_MODE_READ_WRITE); - if (notmuch == NULL) + if (notmuch_database_open (notmuch_config_get_database_path (config), + NOTMUCH_DATABASE_MODE_READ_WRITE, ¬much)) return 1; synchronize_flags = notmuch_config_get_maildir_synchronize_flags (config); diff --git a/notmuch-search.c b/notmuch-search.c index 7dfd270..3be296d 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -486,9 +486,8 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) if (config == NULL) return 1; - notmuch = notmuch_database_open (notmuch_config_get_database_path (config), - NOTMUCH_DATABASE_MODE_READ_ONLY); - if (notmuch == NULL) + if (notmuch_database_open (notmuch_config_get_database_path (config), + NOTMUCH_DATABASE_MODE_READ_ONLY, ¬much)) return 1; query_str = query_string_from_args (notmuch, argc-opt_index, argv+opt_index); diff --git a/notmuch-show.c b/notmuch-show.c index 3b6667c..95427d4 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -1081,9 +1081,8 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[])) return 1; } - notmuch = notmuch_database_open (notmuch_config_get_database_path (config), - NOTMUCH_DATABASE_MODE_READ_ONLY); - if (notmuch == NULL) + if (notmuch_database_open (notmuch_config_get_database_path (config), + NOTMUCH_DATABASE_MODE_READ_ONLY, ¬much)) return 1; query = notmuch_query_create (notmuch, query_string); diff --git a/notmuch-tag.c b/notmuch-tag.c index bd56fd1..7d18639 100644 --- a/notmuch-tag.c +++ b/notmuch-tag.c @@ -229,9 +229,8 @@ notmuch_tag_command (void *ctx, int argc, char *argv[]) if (config == NULL) return 1; - notmuch = notmuch_database_open (notmuch_config_get_database_path (config), - NOTMUCH_DATABASE_MODE_READ_WRITE); - if (notmuch == NULL) + if (notmuch_database_open (notmuch_config_get_database_path (config), + NOTMUCH_DATABASE_MODE_READ_WRITE, ¬much)) return 1; synchronize_flags = notmuch_config_get_maildir_synchronize_flags (config); diff --git a/test/symbol-test.cc b/test/symbol-test.cc index 1548ca4..3e96c03 100644 --- a/test/symbol-test.cc +++ b/test/symbol-test.cc @@ -4,7 +4,8 @@ int main() { - (void) notmuch_database_open("fakedb", NOTMUCH_DATABASE_MODE_READ_ONLY); + notmuch_database_t *notmuch; + notmuch_database_open("fakedb", NOTMUCH_DATABASE_MODE_READ_ONLY, ¬much); try { (void) new Xapian::WritableDatabase("./nonexistant", Xapian::DB_OPEN); -- cgit v1.2.3 From 19c824c3fd7be29a2257cdd530ee23074c978d63 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sat, 4 Aug 2012 09:55:45 -0300 Subject: notmuch-restore: replace positional argument for input with option Since notmuch dump doesn't use positional arguments anymore, it seems better to be consistent. --- man/man1/notmuch-restore.1 | 2 +- notmuch-restore.c | 2 +- test/dump-restore | 8 ++++---- test/maildir-sync | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'notmuch-restore.c') diff --git a/man/man1/notmuch-restore.1 b/man/man1/notmuch-restore.1 index 18281c7..d0d50dd 100644 --- a/man/man1/notmuch-restore.1 +++ b/man/man1/notmuch-restore.1 @@ -6,7 +6,7 @@ notmuch-restore \- restores the tags from the given file (see notmuch dump) .B "notmuch restore" .RB [ "--accumulate" ] -.RI "[ <" filename "> ]" +.RI "[ --input=<" filename "> ]" .SH DESCRIPTION diff --git a/notmuch-restore.c b/notmuch-restore.c index 4f4096e..08d5adc 100644 --- a/notmuch-restore.c +++ b/notmuch-restore.c @@ -122,7 +122,7 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[]) synchronize_flags = notmuch_config_get_maildir_synchronize_flags (config); notmuch_opt_desc_t options[] = { - { NOTMUCH_OPT_POSITION, &input_file_name, 0, 0, 0 }, + { NOTMUCH_OPT_STRING, &input_file_name, "input", 'i', 0 }, { NOTMUCH_OPT_BOOLEAN, &accumulate, "accumulate", 'a', 0 }, { 0, 0, 0, 0, 0 } }; diff --git a/test/dump-restore b/test/dump-restore index c7801cf..f25f7cf 100755 --- a/test/dump-restore +++ b/test/dump-restore @@ -19,7 +19,7 @@ test_expect_success 'Dumping all tags II' \ test_expect_success 'Clearing all tags' \ 'sed -e "s/(\([^(]*\))$/()/" < dump.expected > clear.expected && - notmuch restore clear.expected && + notmuch restore --input=clear.expected && notmuch dump > clear.actual && test_cmp clear.expected clear.actual' @@ -30,7 +30,7 @@ test_expect_success 'Accumulate original tags' \ test_cmp dump-ABC_DEF.expected dump.actual' test_expect_success 'Restoring original tags' \ - 'notmuch restore dump.expected && + 'notmuch restore --input=dump.expected && notmuch dump > dump.actual && test_cmp dump.expected dump.actual' @@ -40,7 +40,7 @@ test_expect_success 'Restore with nothing to do' \ test_cmp dump.expected dump.actual' test_expect_success 'Restore with nothing to do, II' \ - 'notmuch restore --accumulate dump.expected && + 'notmuch restore --accumulate --input=dump.expected && notmuch dump > dump.actual && test_cmp dump.expected dump.actual' @@ -51,7 +51,7 @@ test_expect_success 'Restore with nothing to do, III' \ # notmuch restore currently only considers the first argument. test_expect_success 'Invalid restore invocation' \ - 'test_must_fail notmuch restore dump.expected another_one' + 'test_must_fail notmuch restore --input=dump.expected another_one' test_begin_subtest "dump --output=outfile" notmuch dump --output=dump-outfile.actual diff --git a/test/maildir-sync b/test/maildir-sync index 0914fa5..0fc742a 100755 --- a/test/maildir-sync +++ b/test/maildir-sync @@ -126,7 +126,7 @@ mv $MAIL_DIR/cur/adding-with-s-flag:2,S $MAIL_DIR/cur/adding-with-s-flag:2,RS mv $MAIL_DIR/cur/message-to-move-to-cur:2,S $MAIL_DIR/cur/message-to-move-to-cur:2,DS notmuch dump --output=dump.txt NOTMUCH_NEW >/dev/null -notmuch restore dump.txt +notmuch restore --input=dump.txt output=$(ls $MAIL_DIR/cur) test_expect_equal "$output" "$expected" -- cgit v1.2.3