--- /dev/null
+Return-Path: <too@guru-group.fi>\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 298DC431FB6\r
+ for <notmuch@notmuchmail.org>; Fri, 11 Jan 2013 23:40:30 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ 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 MZeLts13m+so for <notmuch@notmuchmail.org>;\r
+ Fri, 11 Jan 2013 23:40:25 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 52F92431FAF\r
+ for <notmuch@notmuchmail.org>; Fri, 11 Jan 2013 23:40:25 -0800 (PST)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+ id 0D0841001F1; Sat, 12 Jan 2013 09:40:16 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/1] cli: propagate batch tagging warnings to exit value\r
+Date: Sat, 12 Jan 2013 09:40:14 +0200\r
+Message-Id: <1357976414-7468-1-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 1.8.0\r
+Cc: tomi.ollila@iki.fi\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, 12 Jan 2013 07:40:30 -0000\r
+\r
+In case last input for batch tagging was either invalid or skippable\r
+line, notmuch command exited with non-zero value.\r
+After this change if there is at least one invalid line, notmuch\r
+command will exit with non-zero value. Additionally, skipped lines\r
+(last or other) doesn't cause non-zero value to be returned.\r
+---\r
+ notmuch-tag.c | 10 ++++++++--\r
+ 1 file changed, 8 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/notmuch-tag.c b/notmuch-tag.c\r
+index 6408bab..b54c55d 100644\r
+--- a/notmuch-tag.c\r
++++ b/notmuch-tag.c\r
+@@ -140,6 +140,7 @@ tag_file (void *ctx, notmuch_database_t *notmuch, tag_op_flag_t flags,\r
+ size_t line_size = 0;\r
+ ssize_t line_len;\r
+ int ret = 0;\r
++ int warn = 0;\r
+ tag_op_list_t *tag_ops;\r
+ \r
+ tag_ops = tag_op_list_create (ctx);\r
+@@ -154,8 +155,13 @@ tag_file (void *ctx, notmuch_database_t *notmuch, tag_op_flag_t flags,\r
+ ret = parse_tag_line (ctx, line, TAG_FLAG_NONE,\r
+ &query_string, tag_ops);\r
+ \r
+- if (ret > 0)\r
++ if (ret > 0) {\r
++ if (ret != TAG_PARSE_SKIPPED)\r
++ /* remember there has been problematic lines */\r
++ warn = 1;\r
++ ret = 0;\r
+ continue;\r
++ }\r
+ \r
+ if (ret < 0)\r
+ break;\r
+@@ -168,7 +174,7 @@ tag_file (void *ctx, notmuch_database_t *notmuch, tag_op_flag_t flags,\r
+ if (line)\r
+ free (line);\r
+ \r
+- return ret;\r
++ return ret || warn;\r
+ }\r
+ \r
+ int\r
+-- \r
+1.8.0\r
+\r