Re: [PATCH] introduce new.rename_tags for renamed (moved) messages

Subject: Re: [PATCH] introduce new.rename_tags for renamed (moved) messages

Date: Fri, 07 Sep 2018 21:47:26 -0300

To: Michael J Gruber, notmuch@notmuchmail.org

Cc:

From: David Bremner


Michael J Gruber <git@grubix.eu> writes:

>
> Introduce new.rename_tags (default: not set) which are added by `notmuch
> new` to renamed messages. This allows to act upon renames, e.g. to keep
> the IMAP folder structure in sync with tags with a tool like `afew` or
> homecooked scripts simply by filtering for this tag in the same ways as
> one would filter for new messages using new.tags.

The idea seems OK to me. I was hoping for some more feedback from
others, but here we are.

> +        const char **tag;
>  	add_files_state->renamed_messages++;
> +	notmuch_message_freeze (message);
> +
> +	for (tag = add_files_state->rename_tags; tag != NULL && *tag != NULL; tag++) {
> +	    notmuch_message_add_tag (message, *tag);
> +	}
> +
> +

extra blank line

>  	if (add_files_state->synchronize_flags == true)
>  	    notmuch_message_maildir_flags_to_tags (message);
> +	notmuch_message_thaw (message);

Did you have a specific reason for putting the _thaw after the existing
maildir_flags_to_tags? It's probably not important, but if there's no
good reason it seems more natural before.

As a new feature this needs some tests before it can be merged.  You can
start by looking at the tests for new.tags for inspiration I guess
(T050-new.sh and T340-maildir-sync.sh).  One case that occured to me is
that when duplicate files (with the same message-id) exist, deleting one
of them is detected as a rename.
_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: