[PATCH v2] tag: Automatically limit to messages whose tags will actually change.

Tomi Ollila tomi.ollila at iki.fi
Wed Nov 16 09:41:23 PST 2011


On Wed,  9 Nov 2011 08:44:35 -0500, Austin Clements <amdragon at MIT.EDU> wrote:
> This optimizes the user's tagging query to exclude messages that won't
> be affected by the tagging operation, saving computation and IO for
> redundant tagging operations.
> 
> For example,
>   notmuch tag +notmuch to:notmuch at notmuchmail.org
> will now use the query
>   ( to:notmuch at notmuchmail.org ) and (not tag:"notmuch")
> 
> In the past, we've often suggested that people do this exact
> transformation by hand for slow tagging operations.  This makes that
> unnecessary.
> ---
> This version addresses Jani's comments.
> 
>  NEWS          |    9 ++++++
>  notmuch-tag.c |   85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 94 insertions(+), 0 deletions(-)
> 

Reviewed code, looks good

* Empty query string checked before entering _optimize_tag_query
  (if that matters)
* All allocations checked
* The logic look sound and creation of that query string is ok, too.
* I trust escaping is done the way it is done (quotes around, doubling
  any quotes (") in string).

* orig_query_string could be freed in _optimize_query_string()
  the data becomes garbage pointer to it lost after that call.
  However, _optimize_query_string() doesn't know that so it is
  better to leave talloc do the freeing (a bit later).

Tomi


More information about the notmuch mailing list