[RFC 5/5] cli: print number of ignored non-mails encountered in notmuch new scan
authorJani Nikula <jani@nikula.org>
Tue, 3 Nov 2015 19:49:33 +0000 (21:49 +0200)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:49:59 +0000 (14:49 -0700)
35/0a23e05353fe9d369d095812dcbe059adf60fd [new file with mode: 0644]

diff --git a/35/0a23e05353fe9d369d095812dcbe059adf60fd b/35/0a23e05353fe9d369d095812dcbe059adf60fd
new file mode 100644 (file)
index 0000000..790c3fe
--- /dev/null
@@ -0,0 +1,120 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 729816DE1989\r
+ for <notmuch@notmuchmail.org>; Tue,  3 Nov 2015 11:50:43 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.188\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.188 tagged_above=-999 required=5\r
+ tests=[AWL=-0.168, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,\r
+ RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id ZHnx80Fuexqr for <notmuch@notmuchmail.org>;\r
+ Tue,  3 Nov 2015 11:50:41 -0800 (PST)\r
+Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com\r
+ [74.125.82.45]) by arlo.cworth.org (Postfix) with ESMTPS id 69A3E6DE19A0 for\r
+ <notmuch@notmuchmail.org>; Tue,  3 Nov 2015 11:50:21 -0800 (PST)\r
+Received: by wmff134 with SMTP id f134so24167684wmf.0\r
+ for <notmuch@notmuchmail.org>; Tue, 03 Nov 2015 11:50:20 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=nikula_org.20150623.gappssmtp.com; s=20150623;\r
+ h=from:to:cc:subject:date:message-id:in-reply-to:references\r
+ :in-reply-to:references;\r
+ bh=w7HbwoJ2jesoWMPZDOY/Cx+3JFWTDMAPv5pKwQg+Kro=;\r
+ b=VA8G2ccQVGPzKjSJGf2CGgqcw+yaGqWojFVix5BBxSaKqJUnidZwX4pe0W0dOg34/z\r
+ 5x77OwQiCkA3z8IaHCLWne9FwjQ/5S2pgZ2CVRrN6iDak1X4lJBj1GKAVVliAVSDFO+K\r
+ +eE93UyZpRQOrF/6Kt3toBWa77D+g124dIe/w2/DLKT/AXCXGbDN9SA10v0G9wwETlrH\r
+ NnsJrJZ681698owjuiXzexR+rRBwadepiyQpCkp1643VwoPSGyYOq25Q7ouEwfzb3lwU\r
+ fj1o8fBcoaz+0eWo1FfsDNUozXA0PFwBBGzV28GEzTyKzsDobt53SvqHCsKmWSUWETf5\r
+ hDzw==\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+ :references:in-reply-to:references;\r
+ bh=w7HbwoJ2jesoWMPZDOY/Cx+3JFWTDMAPv5pKwQg+Kro=;\r
+ b=J82uGjUUNVWNLXA5J6j5MTe+cuWXVq6qCmsYoUgJxGap0esHnyrXO4tW0Dpwb51jT9\r
+ unn2/bXraKVnJxrkW3v1dC1YxYyIVKW/PsffoTYYVwhDinjA9wTYsEWHYJ2V5uN0g0g5\r
+ IUzRKppldeRBSL+ku6gQmsEbaKoaUSzlSJKVEVFvsfSJPkFyQWTuEH5TSkH3d22Abmxg\r
+ jQ1/WxyEMT46MIGnFdz56wxlvtCWZnTxCr+rczDdUDy2h0ZLnwCDaWdW5ji356yHl803\r
+ 8rDCVSwS4Nk9IKGrcsaEyb4Udlmj9fwVYBkZs3P5VkfuY/8pZywnEi9rvo1jSAQGz3hO\r
+ UwYg==\r
+X-Gm-Message-State:\r
+ ALoCoQlr62LDXlxrtZ9HdDerNBooo8EZtJakbRVv1FTch39PJr+JK1PnFFzVHKWOlaN/kLtHyIlV\r
+X-Received: by 10.28.55.76 with SMTP id e73mr23181582wma.89.1446580219912;\r
+ Tue, 03 Nov 2015 11:50:19 -0800 (PST)\r
+Received: from localhost (mobile-access-bceec0-208.dhcp.inet.fi.\r
+ [188.238.192.208])\r
+ by smtp.gmail.com with ESMTPSA id 20sm24953773wmh.8.2015.11.03.11.50.17\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Tue, 03 Nov 2015 11:50:17 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [RFC 5/5] cli: print number of ignored non-mails encountered in\r
+ notmuch new scan\r
+Date: Tue,  3 Nov 2015 21:49:33 +0200\r
+Message-Id:\r
+ <c29fa2219dc564cc5ac03c70e476c87da7c42530.1446579858.git.jani@nikula.org>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <cover.1446579858.git.jani@nikula.org>\r
+References: <cover.1446579858.git.jani@nikula.org>\r
+In-Reply-To: <cover.1446579858.git.jani@nikula.org>\r
+References: <cover.1446579858.git.jani@nikula.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 03 Nov 2015 19:50:43 -0000\r
+\r
+Also advise the user how to ignore them explicitly.\r
+---\r
+ notmuch-new.c | 7 +++++++\r
+ 1 file changed, 7 insertions(+)\r
+\r
+diff --git a/notmuch-new.c b/notmuch-new.c\r
+index d06f9c906fc6..8d942507364a 100644\r
+--- a/notmuch-new.c\r
++++ b/notmuch-new.c\r
+@@ -54,6 +54,7 @@ typedef struct {\r
+     int total_files;\r
+     int processed_files;\r
+     int added_messages, removed_messages, renamed_messages;\r
++    int ignored_non_mails;\r
+     struct timeval tv_start;\r
\r
+     _filename_list_t *removed_files;\r
+@@ -295,6 +296,7 @@ add_file (notmuch_database_t *notmuch, const char *filename,\r
+           notmuch_message_maildir_flags_to_tags (message);\r
+       break;\r
+     case NOTMUCH_STATUS_FILE_NOT_EMAIL:\r
++      state->ignored_non_mails++;\r
+       fprintf (stderr, "Note: Ignoring non-mail file: %s\n", filename);\r
+       break;\r
+     /* Fatal issues. Don't process anymore. */\r
+@@ -938,6 +940,11 @@ print_results (const add_files_state_t *state)\r
+       printf (" Detected %d file %s.", state->renamed_messages,\r
+               state->renamed_messages == 1 ? "rename" : "renames");\r
\r
++    if (state->ignored_non_mails)\r
++      printf (" Ignored %d non-mail %s. (Use 'notmuch config append new.ignore <pattern> [...]' to ignore explicitly.)",\r
++              state->ignored_non_mails,\r
++              state->ignored_non_mails == 1 ? "file" : "files");\r
++\r
+     printf ("\n");\r
+ }\r
\r
+-- \r
+2.1.4\r
+\r