[RFC 5/5] cli: print number of ignored non-mails encountered in notmuch new scan
Jani Nikula
jani at nikula.org
Tue Nov 3 11:49:33 PST 2015
Also advise the user how to ignore them explicitly.
---
notmuch-new.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/notmuch-new.c b/notmuch-new.c
index d06f9c906fc6..8d942507364a 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -54,6 +54,7 @@ typedef struct {
int total_files;
int processed_files;
int added_messages, removed_messages, renamed_messages;
+ int ignored_non_mails;
struct timeval tv_start;
_filename_list_t *removed_files;
@@ -295,6 +296,7 @@ add_file (notmuch_database_t *notmuch, const char *filename,
notmuch_message_maildir_flags_to_tags (message);
break;
case NOTMUCH_STATUS_FILE_NOT_EMAIL:
+ state->ignored_non_mails++;
fprintf (stderr, "Note: Ignoring non-mail file: %s\n", filename);
break;
/* Fatal issues. Don't process anymore. */
@@ -938,6 +940,11 @@ print_results (const add_files_state_t *state)
printf (" Detected %d file %s.", state->renamed_messages,
state->renamed_messages == 1 ? "rename" : "renames");
+ if (state->ignored_non_mails)
+ printf (" Ignored %d non-mail %s. (Use 'notmuch config append new.ignore <pattern> [...]' to ignore explicitly.)",
+ state->ignored_non_mails,
+ state->ignored_non_mails == 1 ? "file" : "files");
+
printf ("\n");
}
--
2.1.4
More information about the notmuch
mailing list