From cf0293b4a3c730b40d0e4434c624b622ba92575a Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Fri, 15 Apr 2016 22:29:14 +0300 Subject: [PATCH] [RFC PATCH 0/5] cli: notmuch new scandir rework --- b0/f2f7098134af9027e1086f144337f6ca508289 | 108 ++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 b0/f2f7098134af9027e1086f144337f6ca508289 diff --git a/b0/f2f7098134af9027e1086f144337f6ca508289 b/b0/f2f7098134af9027e1086f144337f6ca508289 new file mode 100644 index 000000000..4a5dae9c2 --- /dev/null +++ b/b0/f2f7098134af9027e1086f144337f6ca508289 @@ -0,0 +1,108 @@ +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 860E26DE00EB + for ; Fri, 15 Apr 2016 12:30:46 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.556 +X-Spam-Level: +X-Spam-Status: No, score=-0.556 tagged_above=-999 required=5 tests=[AWL=0.164, + DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, + 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 nEYz8wgo23LO for ; + Fri, 15 Apr 2016 12:30:37 -0700 (PDT) +Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com + [74.125.82.67]) by arlo.cworth.org (Postfix) with ESMTPS id B5A4A6DE00F5 for + ; Fri, 15 Apr 2016 12:30:37 -0700 (PDT) +Received: by mail-wm0-f67.google.com with SMTP id n3so8629323wmn.1 + for ; Fri, 15 Apr 2016 12:30:37 -0700 (PDT) +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; + bh=gTA4HllegNCu2L0ydg4xINdI+VnfmxpVrbUzRT5HHBo=; + b=0+IrOQV0MPGESSxhj3bdTuoOJhgUcpgRyC2vJLseAcKPc62hfmPpL6upEvYRefiKSE + S2G3CUlrstFLaF1xK/uBEdpaYXh6RqWSdqFcuDVE31nNiSqjROHeOh3+aYiQcRd0hkFE + wjrm6SszLiTVlDaFJL4y3lKNsx7XNl0iRXjcTfYhNJ+3fhy5cofRRqCrnbB422YXOoi0 + lfLHb9rbftwPOdUlAXNP3dZP3k2bx/Ag1ct8sO0FUKj1tOcg5L6aMQ+HCKddJGKPMagk + cMEshahndrhQp5qg1nLfgsHIBNmKBJf5jLchZkpT1jmzqTN2tp/iJp9G3uJv+CObhopQ + wtGQ== +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; + bh=gTA4HllegNCu2L0ydg4xINdI+VnfmxpVrbUzRT5HHBo=; + b=P9SONMWuYHPCg0P95R1S4oXMgEbkLTJFmVrW3wKby/EyuPKhTGY0r0fkgGCqCaqSOc + /5zKjGDJSjXi3QaX1JFXfQZo81YYvIvSGOjUJYY8XmMuub8i3LbxlGiXo5SDOhzk/Enq + nm+tH9Q9lda8hPvJQLWOofcprFmeD/U+4MCI0bB7hbaw7MUMEqjZ8US2roZowYQE8dck + Zi1c7BplzEUZcU7Ufw97pcrDpfbYXdn/QKqCCHFu+5fAXBWxQVLRGO4ehUgkhjRc2piH + pcCtzmeLyzX50XKjhnKb1QcZMF1cU+DAKX4CXW26FpfOZvBYoqaIjdI9CUHx6/CvD8mA + /GXQ== +X-Gm-Message-State: + AOPr4FWc7BKHLlTnPoDGqGr6F9HCyKEtgRtepaWdPkeMwPBWF4rlKdWs3nmNVv+G/VkpCw== +X-Received: by 10.194.144.10 with SMTP id si10mr22992574wjb.180.1460748634560; + Fri, 15 Apr 2016 12:30:34 -0700 (PDT) +Received: from localhost (mobile-access-bcee7f-102.dhcp.inet.fi. + [188.238.127.102]) + by smtp.gmail.com with ESMTPSA id i5sm50411782wjx.15.2016.04.15.12.30.33 + (version=TLSv1/SSLv3 cipher=OTHER); + Fri, 15 Apr 2016 12:30:33 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [RFC PATCH 0/5] cli: notmuch new scandir rework +Date: Fri, 15 Apr 2016 22:29:14 +0300 +Message-Id: +X-Mailer: git-send-email 2.1.4 +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: Fri, 15 Apr 2016 19:30:46 -0000 + +David gave some feedback to my old series to add globbing to new.ignore +[1]. One thing that annoyed me in that series was that we have to do the +ignore check in several places. I thought it would be nice to use the +filter parameter to scandir(3) but alas you can't pass a context +parameter there. + +I ended up experimenting with that, and here's the result. Maybe this +makes it easier to read and understand the add_files() function, and +this centralizes the new.ignore handling, but is this really worth it? +I'm unsure. + +Patch 1 is trivial and should be pushed no matter what. + +BR, +Jani. + + +[1] id:871t6efgdt.fsf@maritornes.cs.unb.ca + +Jani Nikula (5): + cli: remove leftover dir variable + cli: drop inode sort order on directories unknown to the database + util: add a homebrew scandir implementation + cli: use homebrew scandir in notmuch new add_files + cli: convert count_files to new scandir + + notmuch-new.c | 382 ++++++++++++++++++++++++++++------------------------ + util/Makefile.local | 2 +- + util/scandir.c | 87 ++++++++++++ + util/scandir.h | 11 ++ + 4 files changed, 305 insertions(+), 177 deletions(-) + create mode 100644 util/scandir.c + create mode 100644 util/scandir.h + +-- +2.1.4 + -- 2.26.2