From: Tomi Ollila <tomi.ollila@iki.fi>
To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org
Subject: Re: [PATCH] cli: bail out and propagate tagging errors in notmuch tag
Date: Wed, 09 Jan 2013 01:51:08 +0200 [thread overview]
Message-ID: <m2d2xftes3.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <1357681314-29384-1-git-send-email-jani@nikula.org>
On Tue, Jan 08 2013, Jani Nikula wrote:
> Checking and propagating tag_op_list_apply() errors is especially
> important with batch tagging, as the processing of the batch input
> would not stop otherwise. Additionally this sets the exit code, which
> is useful in scripts.
> ---
LGTM.
Tomi
> notmuch-tag.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/notmuch-tag.c b/notmuch-tag.c
> index 4272426..16b1668 100644
> --- a/notmuch-tag.c
> +++ b/notmuch-tag.c
> @@ -97,6 +97,7 @@ tag_query (void *ctx, notmuch_database_t *notmuch, const char *query_string,
> notmuch_query_t *query;
> notmuch_messages_t *messages;
> notmuch_message_t *message;
> + int ret = 0;
>
> /* Optimize the query so it excludes messages that already have
> * the specified set of tags. */
> @@ -119,13 +120,15 @@ tag_query (void *ctx, notmuch_database_t *notmuch, const char *query_string,
> notmuch_messages_valid (messages) && ! interrupted;
> notmuch_messages_move_to_next (messages)) {
> message = notmuch_messages_get (messages);
> - tag_op_list_apply (message, tag_ops, flags | TAG_FLAG_PRE_OPTIMIZED);
> + ret = tag_op_list_apply (message, tag_ops, flags | TAG_FLAG_PRE_OPTIMIZED);
> notmuch_message_destroy (message);
> + if (ret)
> + break;
> }
>
> notmuch_query_destroy (query);
>
> - return interrupted;
> + return ret || interrupted;
> }
>
> static int
> --
> 1.7.10.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
next prev parent reply other threads:[~2013-01-08 23:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-08 21:41 [PATCH] cli: bail out and propagate tagging errors in notmuch tag Jani Nikula
2013-01-08 23:51 ` Tomi Ollila [this message]
2013-01-10 3:14 ` David Bremner
2013-01-10 4:26 ` Tomi Ollila
2013-01-10 12:08 ` David Bremner
2013-01-19 13:17 ` [PATCH] notmuch-tag: initialize with enum instead of 0 david
2013-01-19 17:29 ` Tomi Ollila
2013-01-19 18:34 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2d2xftes3.fsf@guru.guru-group.fi \
--to=tomi.ollila@iki.fi \
--cc=jani@nikula.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).