Re: [RFC PATCH v5 01/11] cli: add --no-exclude option to count and search.
authorAustin Clements <amdragon@MIT.EDU>
Fri, 24 Feb 2012 23:03:39 +0000 (18:03 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:44:55 +0000 (09:44 -0800)
04/6a1ad370388f9bbd26cdccf9c3356fce7d2c69 [new file with mode: 0644]

diff --git a/04/6a1ad370388f9bbd26cdccf9c3356fce7d2c69 b/04/6a1ad370388f9bbd26cdccf9c3356fce7d2c69
new file mode 100644 (file)
index 0000000..78f551c
--- /dev/null
@@ -0,0 +1,174 @@
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 08F05416284\r
+       for <notmuch@notmuchmail.org>; Fri, 24 Feb 2012 15:03:43 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id vJoUmxF9ZcLI for <notmuch@notmuchmail.org>;\r
+       Fri, 24 Feb 2012 15:03:42 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU\r
+       [18.9.25.13])\r
+       by olra.theworths.org (Postfix) with ESMTP id 4F0B2414786\r
+       for <notmuch@notmuchmail.org>; Fri, 24 Feb 2012 15:03:42 -0800 (PST)\r
+X-AuditID: 1209190d-b7fbf6d0000008ba-5c-4f48174dd49f\r
+Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
+       by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 61.4B.02234.D47184F4; Fri, 24 Feb 2012 18:03:41 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q1ON3fXv030165; \r
+       Fri, 24 Feb 2012 18:03:41 -0500\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q1ON3dqW020535\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Fri, 24 Feb 2012 18:03:40 -0500 (EST)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1S14At-0000dr-4E; Fri, 24 Feb 2012 18:03:39 -0500\r
+Date: Fri, 24 Feb 2012 18:03:39 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Mark Walters <markwalters1009@gmail.com>\r
+Subject: Re: [RFC PATCH v5 01/11] cli: add --no-exclude option to count and\r
+       search.\r
+Message-ID: <20120224230339.GE30513@mit.edu>\r
+References: <1329296619-7463-1-git-send-email-markwalters1009@gmail.com>\r
+       <1329296619-7463-2-git-send-email-markwalters1009@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <1329296619-7463-2-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFmpileLIzCtJLcpLzFFi42IR4hRV1vUV9/A32NluYrF6Lo/F9ZszmR2Y\r
+       PHbOusvu8WzVLeYApigum5TUnMyy1CJ9uwSujMPLlrEVfJCpePHwOmsD406xLkZODgkBE4m+\r
+       J7dZIWwxiQv31rN1MXJxCAnsY5Q4M2UtK4SzgVFiwuZnLCBVQgInmSRO7s2HSCxhlJg18QF7\r
+       FyMHB4uAqsTHBzIgNWwCGhLb9i9nBLFFBHQkbh9awA5iMwtIS3z73cwEYgsLhEo8mPYDLM4L\r
+       VLOnvZMZYmY7o8S26TNYIBKCEidnPmGBaNaSuPHvJRPILpBBy/9xgIQ5BTwlbrf/ANslKqAi\r
+       MeXkNrYJjEKzkHTPQtI9C6F7ASPzKkbZlNwq3dzEzJzi1GTd4uTEvLzUIl0jvdzMEr3UlNJN\r
+       jOCgluTdwfjuoNIhRgEORiUeXuYt7v5CrIllxZW5hxglOZiURHmXi3n4C/El5adUZiQWZ8QX\r
+       leakFh9ilOBgVhLhtWMDyvGmJFZWpRblw6SkOViUxHlVtd75CQmkJ5akZqemFqQWwWRlODiU\r
+       JHjXgwwVLEpNT61Iy8wpQUgzcXCCDOcBGn4WpIa3uCAxtzgzHSJ/ilFRSpy3HSQhAJLIKM2D\r
+       64UlnVeM4kCvCPMuA6niASYsuO5XQIOZgAbb/3UFGVySiJCSamCccu+aYr6zonHoDc/bf5eu\r
+       iDboldu4fGrw1p77334xNgWrOgpWXE5YVp1csH5TB2NXzM+nrBK+p5NK13HqSURPKmU5oHF6\r
+       5fwfy/18hO3k9EJ+LT82sf1nRISr1c5PhnkZv20OsgWpXs5mTJCrXXj/M6eGvFZls9pc/smp\r
+       V4NyclN+bZnzyEyJpTgj0VCLuag4EQAne2QdFQMAAA==\r
+Cc: notmuch@notmuchmail.org\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://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: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 24 Feb 2012 23:03:43 -0000\r
+\r
+Quoth Mark Walters on Feb 15 at  9:03 am:\r
+> This option turns off the exclusion so all matching messages are\r
+> returned. We do not need to add this to notmuch-show as that does not\r
+> (yet) exclude.\r
+> ---\r
+>  notmuch-count.c  |   17 +++++++++++------\r
+>  notmuch-search.c |   17 +++++++++++------\r
+>  2 files changed, 22 insertions(+), 12 deletions(-)\r
+> \r
+> diff --git a/notmuch-count.c b/notmuch-count.c\r
+> index 63459fb..5364507 100644\r
+> --- a/notmuch-count.c\r
+> +++ b/notmuch-count.c\r
+> @@ -35,8 +35,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
+>      char *query_str;\r
+>      int opt_index;\r
+>      int output = OUTPUT_MESSAGES;\r
+> -    const char **search_exclude_tags;\r
+> -    size_t search_exclude_tags_length;\r
+> +    notmuch_bool_t no_exclude = FALSE;\r
+>      unsigned int i;\r
+>  \r
+>      notmuch_opt_desc_t options[] = {\r
+> @@ -44,6 +43,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
+>        (notmuch_keyword_t []){ { "threads", OUTPUT_THREADS },\r
+>                                { "messages", OUTPUT_MESSAGES },\r
+>                                { 0, 0 } } },\r
+> +    { NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'd', 0 },\r
+>      { 0, 0, 0, 0, 0 }\r
+>      };\r
+>  \r
+> @@ -78,10 +78,15 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
+>      return 1;\r
+>      }\r
+>  \r
+> -    search_exclude_tags = notmuch_config_get_search_exclude_tags\r
+> -    (config, &search_exclude_tags_length);\r
+> -    for (i = 0; i < search_exclude_tags_length; i++)\r
+> -    notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);\r
+> +    if (!no_exclude) {\r
+> +    const char **search_exclude_tags;\r
+> +    size_t search_exclude_tags_length;\r
+> +\r
+> +    search_exclude_tags = notmuch_config_get_search_exclude_tags\r
+> +        (config, &search_exclude_tags_length);\r
+> +    for (i = 0; i < search_exclude_tags_length; i++)\r
+> +        notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);\r
+> +    }\r
+>  \r
+>      switch (output) {\r
+>      case OUTPUT_MESSAGES:\r
+> diff --git a/notmuch-search.c b/notmuch-search.c\r
+> index d504051..43ec90b 100644\r
+> --- a/notmuch-search.c\r
+> +++ b/notmuch-search.c\r
+> @@ -423,8 +423,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
+>      output_t output = OUTPUT_SUMMARY;\r
+>      int offset = 0;\r
+>      int limit = -1; /* unlimited */\r
+> -    const char **search_exclude_tags;\r
+> -    size_t search_exclude_tags_length;\r
+> +    notmuch_bool_t no_exclude = FALSE;\r
+>      unsigned int i;\r
+>  \r
+>      enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }\r
+> @@ -446,6 +445,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
+>                                { "files", OUTPUT_FILES },\r
+>                                { "tags", OUTPUT_TAGS },\r
+>                                { 0, 0 } } },\r
+> +        { NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'd', 0 },\r
+\r
+Indentation error.  Otherwise this patch LGTM.\r
+\r
+>      { NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 },\r
+>      { NOTMUCH_OPT_INT, &limit, "limit", 'L', 0  },\r
+>      { 0, 0, 0, 0, 0 }\r
+> @@ -493,10 +493,15 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
+>  \r
+>      notmuch_query_set_sort (query, sort);\r
+>  \r
+> -    search_exclude_tags = notmuch_config_get_search_exclude_tags\r
+> -    (config, &search_exclude_tags_length);\r
+> -    for (i = 0; i < search_exclude_tags_length; i++)\r
+> -    notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);\r
+> +    if (!no_exclude) {\r
+> +    const char **search_exclude_tags;\r
+> +    size_t search_exclude_tags_length;\r
+> +\r
+> +    search_exclude_tags = notmuch_config_get_search_exclude_tags\r
+> +        (config, &search_exclude_tags_length);\r
+> +    for (i = 0; i < search_exclude_tags_length; i++)\r
+> +        notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);\r
+> +    }\r
+>  \r
+>      switch (output) {\r
+>      default:\r