--- /dev/null
+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 B6EBD431FAF\r
+ for <notmuch@notmuchmail.org>; Mon, 21 Jan 2013 10:05:13 -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 RESPAjkmFLY2 for <notmuch@notmuchmail.org>;\r
+ Mon, 21 Jan 2013 10:05:13 -0800 (PST)\r
+Received: from mail-bk0-f41.google.com (mail-bk0-f41.google.com\r
+ [209.85.214.41]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 00162431FAE\r
+ for <notmuch@notmuchmail.org>; Mon, 21 Jan 2013 10:05:12 -0800 (PST)\r
+Received: by mail-bk0-f41.google.com with SMTP id jg9so3315307bkc.0\r
+ for <notmuch@notmuchmail.org>; Mon, 21 Jan 2013 10:05:11 -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:subject:in-reply-to:references:user-agent:date\r
+ :message-id:mime-version:content-type:x-gm-message-state;\r
+ bh=jzonoBlp3g+vjyOZ8KS0Kae3836LIfhhJIAtrrPxomM=;\r
+ b=H8M5mcZqg/4wVcFRD+EX0hkn4ja7L+Ng9mmx4oO0ve92BE1V9v5drgSw4OXlgzU/WK\r
+ EuOfY/e9U8bqSabXro0b5PlliHqB8YvRKwvMFb/V8Kfr77D7MIidACSwcQ/nEWW129ea\r
+ Ja6Um8XJV/GPX3ZdcH6Gsx2mSrpJMCMJs+OIkbpOyo+JNDLReZZNwwO7sKYjcxlW4uiy\r
+ q3pPxTPur7dSjOw89R9GGhdNJmLph3NbU9rcbVeNQfMOaYSMxQXzztWpr95cwsPFty4a\r
+ X5t0zZCMqZDarR5Vy/ffgh1/6gj2fiwuXQBOoEE4aDyygUUBr9DNrystAo/fCbMrGwnM\r
+ AMzA==\r
+X-Received: by 10.204.3.206 with SMTP id 14mr5093578bko.120.1358791510116;\r
+ Mon, 21 Jan 2013 10:05:10 -0800 (PST)\r
+Received: from localhost ([2001:4b98:dc0:43:216:3eff:fe1b:25f3])\r
+ by mx.google.com with ESMTPS id q22sm9254720bkv.16.2013.01.21.10.05.07\r
+ (version=TLSv1.1 cipher=RC4-SHA bits=128/128);\r
+ Mon, 21 Jan 2013 10:05:08 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: Peter Wang <novalazy@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v3 08/20] tag-util: move out 'tag' command-line checks\r
+In-Reply-To: <1358643004-14522-9-git-send-email-novalazy@gmail.com>\r
+References: <1358643004-14522-1-git-send-email-novalazy@gmail.com>\r
+ <1358643004-14522-9-git-send-email-novalazy@gmail.com>\r
+User-Agent: Notmuch/0.14+259~gdee88db (http://notmuchmail.org) Emacs/23.2.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Mon, 21 Jan 2013 19:05:00 +0100\r
+Message-ID: <87boci2z03.fsf@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Gm-Message-State:\r
+ ALoCoQnCtVWcgeCNxuHsycdsooJhSilZdoY8glHuz8nRH1R6sSBDxN1QDIbQQRWxffieHpgOj6D5\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: Mon, 21 Jan 2013 18:05:13 -0000\r
+\r
+On Sun, 20 Jan 2013, Peter Wang <novalazy@gmail.com> wrote:\r
+> parse_tag_command_line checked for two error conditions which are\r
+> specific to the 'tag' command. It can be reused for the notmuch\r
+> 'insert' command if we move the checks out, into notmuch-tag.c.\r
+\r
+*three* error conditions, two of which are specific to notmuch tag. See\r
+ below.\r
+\r
+> ---\r
+> notmuch-tag.c | 10 ++++++++++\r
+> tag-util.c | 10 ----------\r
+> 2 files changed, 10 insertions(+), 10 deletions(-)\r
+>\r
+> diff --git a/notmuch-tag.c b/notmuch-tag.c\r
+> index d9daf8f..a901dad 100644\r
+> --- a/notmuch-tag.c\r
+> +++ b/notmuch-tag.c\r
+> @@ -234,6 +234,16 @@ notmuch_tag_command (void *ctx, int argc, char *argv[])\r
+> if (parse_tag_command_line (ctx, 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
+> + if (*query_string == '\0') {\r
+> + fprintf (stderr, "Error: notmuch tag requires at least one search term.\n");\r
+> + return 1;\r
+> + }\r
+> }\r
+> \r
+> config = notmuch_config_open (ctx, NULL, NULL);\r
+> diff --git a/tag-util.c b/tag-util.c\r
+> index 3f9da05..41f2c09 100644\r
+> --- a/tag-util.c\r
+> +++ b/tag-util.c\r
+> @@ -186,18 +186,8 @@ 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
+You must leave *query_str == NULL check intact here. Fix the error\r
+message to be about allocation failure and drop the reference to notmuch\r
+tag while at it.\r
+\r
+Otherwise LGTM.\r
+\r
+> - fprintf (stderr, "Error: notmuch tag requires at least one search term.\n");\r
+> - return TAG_PARSE_INVALID;\r
+> - }\r
+> -\r
+> return TAG_PARSE_SUCCESS;\r
+> }\r
+> \r
+> -- \r
+> 1.7.12.1\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r