unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jani Nikula <jani@nikula.org>
To: notmuch@notmuchmail.org
Subject: [RFC 5/5] cli: print number of ignored non-mails encountered in notmuch new scan
Date: Tue,  3 Nov 2015 21:49:33 +0200	[thread overview]
Message-ID: <c29fa2219dc564cc5ac03c70e476c87da7c42530.1446579858.git.jani@nikula.org> (raw)
In-Reply-To: <cover.1446579858.git.jani@nikula.org>
In-Reply-To: <cover.1446579858.git.jani@nikula.org>

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

  parent reply	other threads:[~2015-11-03 19:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-03 19:49 [RFC 0/5] globbing on new.ignore etc Jani Nikula
2015-11-03 19:49 ` [RFC 1/5] cli: fix function name in notmuch new debug logging Jani Nikula
2015-12-30 15:31   ` David Bremner
2015-11-03 19:49 ` [RFC 2/5] cli: don't call _entry_in_ignore_list twice in count files debug Jani Nikula
2016-04-09 23:56   ` David Bremner
2015-11-03 19:49 ` [RFC 3/5] cli: support shell globbing patterns in new.ignore Jani Nikula
2016-04-10  0:37   ` David Bremner
2017-03-11 14:35   ` David Bremner
2015-11-03 19:49 ` [RFC 4/5] cli: add notmuch config append command to append to string list configs Jani Nikula
2015-11-03 19:49 ` Jani Nikula [this message]
2017-03-11 14:42   ` [RFC 5/5] cli: print number of ignored non-mails encountered in notmuch new scan David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c29fa2219dc564cc5ac03c70e476c87da7c42530.1446579858.git.jani@nikula.org \
    --to=jani@nikula.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).