From: Austin Clements Date: Fri, 3 Feb 2012 22:44:55 +0000 (+1900) Subject: Re: [PATCH] test: add tests wrt ignoring user-specified files and directories X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=a00ac07c1881ec077b1b128be8d50282d00d5272;p=notmuch-archives.git Re: [PATCH] test: add tests wrt ignoring user-specified files and directories --- diff --git a/c3/738aa1e2afcb9fbeacf5279f68a4dd389124cc b/c3/738aa1e2afcb9fbeacf5279f68a4dd389124cc new file mode 100644 index 000000000..61bd843a0 --- /dev/null +++ b/c3/738aa1e2afcb9fbeacf5279f68a4dd389124cc @@ -0,0 +1,137 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id D51C8431FAF + for ; Fri, 3 Feb 2012 14:46:02 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id x8RKZAZeZk3v for ; + Fri, 3 Feb 2012 14:46:02 -0800 (PST) +Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU + [18.9.25.13]) + by olra.theworths.org (Postfix) with ESMTP id 32C4F431FAE + for ; Fri, 3 Feb 2012 14:46:02 -0800 (PST) +X-AuditID: 1209190d-b7fbf6d0000008ba-5c-4f2c63a98d0d +Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) + by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP + id F3.E0.02234.9A36C2F4; Fri, 3 Feb 2012 17:46:01 -0500 (EST) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q13Mk0vO009754; + Fri, 3 Feb 2012 17:46:00 -0500 +Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q13MjweI019606 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Fri, 3 Feb 2012 17:45:59 -0500 (EST) +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) + (envelope-from ) + id 1RtRsG-0001en-1i; Fri, 03 Feb 2012 17:44:56 -0500 +From: Austin Clements +To: Pieter Praet , David Edmondson , + Tomi Ollila , David Bremner +Subject: Re: [PATCH] test: add tests wrt ignoring user-specified files and + directories +In-Reply-To: <1328105573-4626-1-git-send-email-pieter@praet.org> +References: + <1328105573-4626-1-git-send-email-pieter@praet.org> +User-Agent: Notmuch/0.11+118~g220ee2c (http://notmuchmail.org) Emacs/23.3.1 + (i486-pc-linux-gnu) +Date: Fri, 03 Feb 2012 17:44:55 -0500 +Message-ID: <874nv7wn88.fsf@awakening.csail.mit.edu> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFuphleLIzCtJLcpLzFFi42IR4hRV1l2ZrONvMOetnsWN1m5Gi313tjBZ + XL85k9ni9+sbzBZvVs5jdWD12PX8L5PH4a8LWTyerbrF7NGx7zKrx5ZD75kDWKO4bFJSczLL + Uov07RK4MlZ/esRW0C1YceTJf6YGxuV8XYycHBICJhIdO3uZIGwxiQv31rN1MXJxCAnsY5T4 + uL+JHcJZzyjxtvkgI4RzgkniSfMCVghnCaPEl/NTmUH62QQ0JLbtXw5WJSIwgVGi+dscNpAE + s4CWxNaNHxhBbGGBMIlXW1vBGjgFHCSeNDawg9hCAvkSX169YQGxRQXiJe7MXQnWyyKgKrHu + 5yOgOAcHL9Cxhxu5QMK8AoISJ2c+YYEZf+PfS6YJjIKzkKRmIUktYGRaxSibklulm5uYmVOc + mqxbnJyYl5dapGukl5tZopeaUrqJERzokrw7GN8dVDrEKMDBqMTDu0FPx1+INbGsuDL3EKMk + B5OSKG9QAlCILyk/pTIjsTgjvqg0J7X4EKMEB7OSCK+VOlCONyWxsiq1KB8mJc3BoiTOq6r1 + zk9IID2xJDU7NbUgtQgmK8PBoSTBywiMaCHBotT01Iq0zJwShDQTByfIcB6g4RIgNbzFBYm5 + xZnpEPlTjIpS4rwiIAkBkERGaR5cLywRvWIUB3pFmFcOpIoHmMTgul8BDWYCGsxgoQkyuCQR + ISXVwBj+X6xq64k9u9R3VEqfqoq9nednL/YjxsdlS/TcP9+qhO7x/pwd6mLyZkV16Yfv/I5C + HTbeiyRig/YViInlrwyJV12x64DvVu8zCVl39vy+++zCieK59mbaLY0VrPNr0m9v3bTsIWPH + D4fmywGmR1SSfTgqMzo2r7Fu+KAY1Zko9yxaaPa3OCWW4oxEQy3mouJEALfHTTkfAwAA +Cc: Notmuch Mail +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +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: Fri, 03 Feb 2012 22:46:03 -0000 + +On Wed, 1 Feb 2012 15:12:53 +0100, Pieter Praet wrote: +> Files and directories which are specified in 'new.ignore' in the +> config file shouldn't be indexed nor reported by `notmuch new'. +> +> --- +> test/new | 23 +++++++++++++++++++++++ +> 1 files changed, 23 insertions(+), 0 deletions(-) +> +> diff --git a/test/new b/test/new +> index 49f390d..740ba05 100755 +> --- a/test/new +> +++ b/test/new +> @@ -153,4 +153,27 @@ rm -rf "${MAIL_DIR}"/two +> output=$(NOTMUCH_NEW) +> test_expect_equal "$output" "No new mail. Removed 3 messages." +> +> +test_begin_subtest "Skip and report non-mail files" +> +generate_message +> +mkdir -p "${MAIL_DIR}"/.git && touch "${MAIL_DIR}"/.git/config +> +touch "${MAIL_DIR}"/ignored_file +> +touch "${MAIL_DIR}"/.ignored_hidden_file +> +output=$(NOTMUCH_NEW 2>&1) +> +test_expect_equal "$output" \ +> +"Note: Ignoring non-mail file: ${MAIL_DIR}/.git/config +> +Note: Ignoring non-mail file: ${MAIL_DIR}/.ignored_hidden_file +> +Note: Ignoring non-mail file: ${MAIL_DIR}/ignored_file +> +Added 1 new message to the database." +> + +> +test_begin_subtest "Ignore files and directories specified in new.ignore" +> +test_subtest_known_broken +> +generate_message +> +notmuch config set new.ignore .git ignored_file .ignored_hidden_file +> +mkdir -p "${MAIL_DIR}"/.git && touch "${MAIL_DIR}"/.git/config + +This doesn't change .git's mtime, so notmuch new may not scan it (*may* +not because it's possible/likely notmuch refused to record the mtime in +the above test on account of lack of granularity). Probably you should +just touch "${MAIL_DIR}"/.git. Or maybe touch a new file under it. + +> +touch "${MAIL_DIR}"/ignored_file +> +touch "${MAIL_DIR}"/.ignored_hidden_file + +These aren't necessary since these files already exist and they won't +touch the directory's mtime (though the generate_message will). + +> +output=$(NOTMUCH_NEW 2>&1) +> +test_expect_equal "$output" "Added 1 new message to the database." +> + +> + +> test_done +> -- +> 1.7.8.1 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch +>