question about deletion and counts
Jeff Templon
templon at nikhef.nl
Thu Nov 8 02:01:19 PST 2018
Hi Carl,
Thanks for your answer.
Carl Worth <cworth at cworth.org> writes:
> A file rename is a high-level operation that will be seen by notmuch as
> multiple operations seen over the course of a single run of notmuch
> new:
>
> 1. A new file is added with a message ID that already exists in the
> database
>
> 2. A file is removed with a message ID for which there are multiple
> files in the database
>
> But notmuch doesn't detect whether both of these operations are seen in
> a single pass in order to detect a rename. Instead, what it is doing is
> counting every occurence of (2) above as a rename. Here's what the code
> looks like (notmuch-new.c:remove_filename):
>
> status = notmuch_database_remove_message (notmuch, path);
> if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) {
> add_files_state->renamed_messages++;
> if (add_files_state->synchronize_flags == true)
> notmuch_message_maildir_flags_to_tags (message);
> status = NOTMUCH_STATUS_SUCCESS;
> } else if (status == NOTMUCH_STATUS_SUCCESS) {
> add_files_state->removed_messages++;
> }
Perfect explanation, thanks.
> I suppose you could come up with some other name for what it is
> counting, such as "removals of duplicate messages" instead of "rename",
> but that's what's happening.
Yes, that'd be my suggestion :-) It's one of my personal buttons that
sometimes get pushed "name is misleading". If you seriously consider
it, I'd suggest "file reassignments" instead of "file renames". A file
rename to me is
mv jeff.txt carl.txt
the file was named jeff.txt but was renamed to carl.txt. The case you
describe, a file with a certain name is either assigned to a messageID,
or de-assigned to that messageID - the actual file name is not changed,
as I understand it.
Anyway thanks for the explanation! Good that I don't need to worry.
BTW I've got integration between org and notmuch up and running now, I'm
really liking this capability.
JT
More information about the notmuch
mailing list