From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id YPxcBdn9S2OMQAAAbAwnHQ (envelope-from ) for ; Sun, 16 Oct 2022 14:49:29 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id GAhjBNn9S2MjegEAG6o9tA (envelope-from ) for ; Sun, 16 Oct 2022 14:49:29 +0200 Received: from mail.notmuchmail.org (yantan.tethera.net [135.181.149.255]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id CCA07CAD5 for ; Sun, 16 Oct 2022 14:49:28 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id D6B745E01E; Sun, 16 Oct 2022 12:49:23 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id 59B965DC0A for ; Sun, 16 Oct 2022 12:49:21 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id 3E9A65FBC0; Sun, 16 Oct 2022 08:49:20 -0400 (EDT) Received: (nullmailer pid 663237 invoked by uid 1000); Sun, 16 Oct 2022 12:49:18 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH] CLI/git: use --exclude=false when calling notmuch-search Date: Sun, 16 Oct 2022 09:49:00 -0300 Message-Id: <20221016124900.662786-1-david@tethera.net> X-Mailer: git-send-email 2.35.2 MIME-Version: 1.0 Message-ID-Hash: UKXMMDPC243VPPMBLVOCTACMECV7PQ7Z X-Message-ID-Hash: UKXMMDPC243VPPMBLVOCTACMECV7PQ7Z X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1665924568; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=3CMpDCyO4xiMIDF9+ok2X+5ZeNhiG0sq1v05ymYC5wM=; b=aDg8ne09FyFOGIElFYYV7mD117tUiQWYMooI3LTNlMm4HC5trgHDdVaTipKO6yQG96wZYj L7LYiXY0O5GiSXHzvapXEP5a4csnPTA8CsfgQEhC2fJmoKcYiJUjCXWN2d4IWde1ccMJ8c MDcp6epE3luG8W2VnNf9nojNh4bHOx742iewUBy5bIxc571of881HvoHCc2PryAty9ya3e YdEowr4vjsO0mncGmxAS2OrnjwZWYKgNu8S4WghrTyUDXd0u9eLpJ2l4sOBXZRo71RVZzF aSn+u1NgHAlL4/4X+kcXd4L5M9eLaoMHFnKyf4x+HSDHoVvkGBeCo7aSnzJlwg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1665924568; a=rsa-sha256; cv=none; b=NB8CVqFoPQIkWwD5GY12kovRzsvs/Of61oHLhjJPNIACvgbkoAYI+Atu+hQsJdac39bS2X 4rbtevfwb1p0bxdjQElcfBqvC9Mak/4C8CJnWUq1Db0rnymrAn4e7nVr9IVyhHtBI0clJe Rbt68eFnpuM7mcMk6/SFdM6CJRb/JPr64MlyMy/goRTzjWRUnJZJmH+JJy1ND9IWzrkSIg NC08PRRAVarJzNI39LECOR2WID/qgYKUDWIPAzEfpfpGkfaJyLe3E+9dz2LVdw2VcKitSQ SHy1ZHaNeisJUdcez1XjvBXbbaeKQl7e1IOkpUuRozqBHTtBbqKdcSewHh8aTw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.08 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: CCA07CAD5 X-Spam-Score: -1.08 X-Migadu-Scanner: scn1.migadu.com X-TUID: VTq7JNHoTf8u We use notmuch search in two places in notmuch-git.py: to find which tags have a given prefix, and to see if message with given id exists locally. In both cases we do not want the presence of exclude tags (e.g. deleted) to change the results. --- notmuch-git.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) The effects of this bug are a bit subtle; out of 12324 messages tagged 'deleted', without this fix I was missing 25 messages. That probably explains why I couldn't come up with a test to demonstrate the issue. On other hand, I think it is pretty clearly the right thing to do, even if most people don't notice a change. diff --git a/notmuch-git.py b/notmuch-git.py index ceb86fbc..57098aae 100644 --- a/notmuch-git.py +++ b/notmuch-git.py @@ -254,7 +254,7 @@ def count_messages(prefix=None): def get_tags(prefix=None): "Get a list of tags with a given prefix." (status, stdout, stderr) = _spawn( - args=['notmuch', 'search', '--query=sexp', '--output=tags', _tag_query(prefix)], + args=['notmuch', 'search', '--exclude=false', '--query=sexp', '--output=tags', _tag_query(prefix)], stdout=_subprocess.PIPE, wait=True) return [tag for tag in stdout.splitlines()] @@ -719,7 +719,7 @@ class DatabaseCache: self._known[id] = False else: (_, stdout, stderr) = _spawn( - args=['notmuch', 'search', '--output=files', 'id:{0}'.format(id)], + args=['notmuch', 'search', '--exclude=false', '--output=files', 'id:{0}'.format(id)], stdout=_subprocess.PIPE, wait=True) self._known[id] = stdout != None -- 2.35.2