From: Jani Nikula Date: Tue, 3 Nov 2015 19:49:33 +0000 (+0200) Subject: [RFC 5/5] cli: print number of ignored non-mails encountered in notmuch new scan X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2bdf937716503bd19b0e96845b0c09da62d05b57;p=notmuch-archives.git [RFC 5/5] cli: print number of ignored non-mails encountered in notmuch new scan --- diff --git a/35/0a23e05353fe9d369d095812dcbe059adf60fd b/35/0a23e05353fe9d369d095812dcbe059adf60fd new file mode 100644 index 000000000..790c3fe27 --- /dev/null +++ b/35/0a23e05353fe9d369d095812dcbe059adf60fd @@ -0,0 +1,120 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 729816DE1989 + for ; Tue, 3 Nov 2015 11:50:43 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" +X-Spam-Flag: NO +X-Spam-Score: -0.188 +X-Spam-Level: +X-Spam-Status: No, score=-0.188 tagged_above=-999 required=5 + tests=[AWL=-0.168, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, + RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id ZHnx80Fuexqr for ; + Tue, 3 Nov 2015 11:50:41 -0800 (PST) +Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com + [74.125.82.45]) by arlo.cworth.org (Postfix) with ESMTPS id 69A3E6DE19A0 for + ; Tue, 3 Nov 2015 11:50:21 -0800 (PST) +Received: by wmff134 with SMTP id f134so24167684wmf.0 + for ; Tue, 03 Nov 2015 11:50:20 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=nikula_org.20150623.gappssmtp.com; s=20150623; + h=from:to:cc:subject:date:message-id:in-reply-to:references + :in-reply-to:references; + bh=w7HbwoJ2jesoWMPZDOY/Cx+3JFWTDMAPv5pKwQg+Kro=; + b=VA8G2ccQVGPzKjSJGf2CGgqcw+yaGqWojFVix5BBxSaKqJUnidZwX4pe0W0dOg34/z + 5x77OwQiCkA3z8IaHCLWne9FwjQ/5S2pgZ2CVRrN6iDak1X4lJBj1GKAVVliAVSDFO+K + +eE93UyZpRQOrF/6Kt3toBWa77D+g124dIe/w2/DLKT/AXCXGbDN9SA10v0G9wwETlrH + NnsJrJZ681698owjuiXzexR+rRBwadepiyQpCkp1643VwoPSGyYOq25Q7ouEwfzb3lwU + fj1o8fBcoaz+0eWo1FfsDNUozXA0PFwBBGzV28GEzTyKzsDobt53SvqHCsKmWSUWETf5 + hDzw== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to + :references:in-reply-to:references; + bh=w7HbwoJ2jesoWMPZDOY/Cx+3JFWTDMAPv5pKwQg+Kro=; + b=J82uGjUUNVWNLXA5J6j5MTe+cuWXVq6qCmsYoUgJxGap0esHnyrXO4tW0Dpwb51jT9 + unn2/bXraKVnJxrkW3v1dC1YxYyIVKW/PsffoTYYVwhDinjA9wTYsEWHYJ2V5uN0g0g5 + IUzRKppldeRBSL+ku6gQmsEbaKoaUSzlSJKVEVFvsfSJPkFyQWTuEH5TSkH3d22Abmxg + jQ1/WxyEMT46MIGnFdz56wxlvtCWZnTxCr+rczDdUDy2h0ZLnwCDaWdW5ji356yHl803 + 8rDCVSwS4Nk9IKGrcsaEyb4Udlmj9fwVYBkZs3P5VkfuY/8pZywnEi9rvo1jSAQGz3hO + UwYg== +X-Gm-Message-State: + ALoCoQlr62LDXlxrtZ9HdDerNBooo8EZtJakbRVv1FTch39PJr+JK1PnFFzVHKWOlaN/kLtHyIlV +X-Received: by 10.28.55.76 with SMTP id e73mr23181582wma.89.1446580219912; + Tue, 03 Nov 2015 11:50:19 -0800 (PST) +Received: from localhost (mobile-access-bceec0-208.dhcp.inet.fi. + [188.238.192.208]) + by smtp.gmail.com with ESMTPSA id 20sm24953773wmh.8.2015.11.03.11.50.17 + (version=TLSv1/SSLv3 cipher=OTHER); + Tue, 03 Nov 2015 11:50:17 -0800 (PST) +From: Jani Nikula +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 +Message-Id: + +X-Mailer: git-send-email 2.1.4 +In-Reply-To: +References: +In-Reply-To: +References: +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Tue, 03 Nov 2015 19:50:43 -0000 + +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 [...]' to ignore explicitly.)", ++ state->ignored_non_mails, ++ state->ignored_non_mails == 1 ? "file" : "files"); ++ + printf ("\n"); + } + +-- +2.1.4 +