#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include "string-util.h"
static volatile sig_atomic_t interrupted;
notmuch_message_t *message;
notmuch_status_t status;
- status = notmuch_database_add_message (notmuch, path, &message);
+ status = notmuch_database_index_file (notmuch, path, NULL, &message);
if (status == NOTMUCH_STATUS_SUCCESS) {
status = tag_op_list_apply (message, tag_ops, 0);
if (status) {
size_t new_tags_length;
tag_op_list_t *tag_ops;
char *query_string = NULL;
- const char *folder = NULL;
+ char *folder = NULL;
notmuch_bool_t create_folder = FALSE;
notmuch_bool_t keep = FALSE;
notmuch_bool_t no_hooks = FALSE;
if (folder == NULL) {
maildir = db_path;
} else {
+ strip_trailing (folder, '/');
if (! is_valid_folder_name (folder)) {
fprintf (stderr, "Error: invalid folder name: '%s'\n", folder);
return EXIT_FAILURE;