[PATCH v2 1/4] cli: make caller check tag count in parse_tag_command_line
authorJani Nikula <jani@nikula.org>
Sat, 9 Mar 2013 14:56:48 +0000 (16:56 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:53:58 +0000 (09:53 -0800)
3f/f04c1898c65f44dceb3804cb76233112f887cc [new file with mode: 0644]

diff --git a/3f/f04c1898c65f44dceb3804cb76233112f887cc b/3f/f04c1898c65f44dceb3804cb76233112f887cc
new file mode 100644 (file)
index 0000000..d29e430
--- /dev/null
@@ -0,0 +1,110 @@
+Return-Path: <jani@nikula.org>\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 A826E431FAF\r
+       for <notmuch@notmuchmail.org>; Sat,  9 Mar 2013 06:56:58 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\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 sVE43W-E6peB for <notmuch@notmuchmail.org>;\r
+       Sat,  9 Mar 2013 06:56:58 -0800 (PST)\r
+Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com\r
+       [209.85.217.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 0DFC0431FAE\r
+       for <notmuch@notmuchmail.org>; Sat,  9 Mar 2013 06:56:57 -0800 (PST)\r
+Received: by mail-lb0-f172.google.com with SMTP id n8so2079196lbj.3\r
+       for <notmuch@notmuchmail.org>; Sat, 09 Mar 2013 06:56:56 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to\r
+       :references:in-reply-to:references:x-gm-message-state;\r
+       bh=yPjzWOdSh1kW90PtUSe1QKGmaBSEWwwcXgtTDiNJhS8=;\r
+       b=ERzn75uY6lGQQAALABva709Rv12skPJEitgHnKDLKB9ZK+YzVvWyBUfujirZ+E3hB1\r
+       wvGygK3iinKQCjdYPxHDWcF/bgCsTBoAu7zOSzqyYIGCiUSUj5W6kK2/mgeFqg8npmlm\r
+       VU8PrXMk0B3I7sCBUBcgNo6scYjQyBRbA9d+b0I9wc6X2/KQcQrm1IXa0Z/T02Yeu7dJ\r
+       dBjtQG9LmMekWtrievS2cOM7ivsSDU0Jyuijvut5CCFjP69cfQq7BxE2xyvp/3zUSf6B\r
+       N0Cek7X3w45qyu+2eaqALzrOhJmr9fk1bjvc0GGMAiMCQ/t9ZGWuswQrRcP+Pfz2XV4H\r
+       rDhQ==\r
+X-Received: by 10.152.133.52 with SMTP id oz20mr5184947lab.30.1362841016522;\r
+       Sat, 09 Mar 2013 06:56:56 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw4-50df51-27.dhcp.inet.fi.\r
+       [80.223.81.27])\r
+       by mx.google.com with ESMTPS id iq6sm4256051lab.10.2013.03.09.06.56.54\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Sat, 09 Mar 2013 06:56:55 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 1/4] cli: make caller check tag count in\r
+       parse_tag_command_line\r
+Date: Sat,  9 Mar 2013 16:56:48 +0200\r
+Message-Id:\r
+ <e25bebb5c141ea7291b08c81f5285484ad43fc3c.1362840893.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <cover.1362840893.git.jani@nikula.org>\r
+References: <cover.1362840893.git.jani@nikula.org>\r
+In-Reply-To: <cover.1362840893.git.jani@nikula.org>\r
+References: <cover.1362840893.git.jani@nikula.org>\r
+X-Gm-Message-State:\r
+ ALoCoQkc2/dRPl6Y+4XYi5BF8pFYA15kEnXjiXKqk7ap6OjrG8wxLDh2FbR6O8eUqv/WNVN6AEBo\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: Sat, 09 Mar 2013 14:56:58 -0000\r
+\r
+---\r
+ notmuch-tag.c |    5 +++++\r
+ tag-util.c    |    5 -----\r
+ 2 files changed, 5 insertions(+), 5 deletions(-)\r
+\r
+diff --git a/notmuch-tag.c b/notmuch-tag.c\r
+index 0e73197..bc61aab 100644\r
+--- a/notmuch-tag.c\r
++++ b/notmuch-tag.c\r
+@@ -233,6 +233,11 @@ notmuch_tag_command (notmuch_config_t *config, int argc, char *argv[])\r
+       if (parse_tag_command_line (config, argc - opt_index, argv + opt_index,\r
+                                   &query_string, tag_ops))\r
+           return 1;\r
++\r
++      if (tag_op_list_size (tag_ops) == 0) {\r
++          fprintf (stderr, "Error: 'notmuch tag' requires at least one tag to add or remove.\n");\r
++          return 1;\r
++      }\r
+     }\r
\r
+     if (notmuch_database_open (notmuch_config_get_database_path (config),\r
+diff --git a/tag-util.c b/tag-util.c\r
+index 701d329..c5f5859 100644\r
+--- a/tag-util.c\r
++++ b/tag-util.c\r
+@@ -188,11 +188,6 @@ parse_tag_command_line (void *ctx, int argc, char **argv,\r
+       tag_op_list_append (tag_ops, argv[i] + 1, is_remove);\r
+     }\r
\r
+-    if (tag_op_list_size (tag_ops) == 0) {\r
+-      fprintf (stderr, "Error: 'notmuch tag' requires at least one tag to add or remove.\n");\r
+-      return TAG_PARSE_INVALID;\r
+-    }\r
+-\r
+     *query_str = query_string_from_args (ctx, argc - i, &argv[i]);\r
\r
+     if (*query_str == NULL || **query_str == '\0') {\r
+-- \r
+1.7.10.4\r
+\r