Adding support for "notmuch new ... PATH"

Carl Worth cworth at cworth.org
Thu Nov 4 11:35:41 PDT 2010


On Sat, 23 Oct 2010 12:16:11 -0500, Rob Browning <rlb at defaultvalue.org> wrote:
> I'm working on support for something like
> 
>   notmuch new [--] [PATH ..]
> 
> where PATH can be any path (file or dir) within the mail directory,

Hi Rob,

Thanks for doing this work. I hope that it will prove useful.

I know we've chatted about this work from time to time in the #notmuch
IRC channel, (and the performance concerns you have that are motivating
this work). Here's something thing to keep in mind as you consider an
approach were you only add explicit files to the database:

In addition to adding new messages, the "notmuch new" command is also
responsible for identifying files that have been deleted from the
filesystem and updating the database. So if you switched to explicit
"notmuch new -- PATH" for adding new files, you'd still want to do
something for deleted files, (perhaps a similar, explicit-path command
for those as well?).

> I had a couple of questions:
> 
>   1) What happens if you call notmuch_database_add_message() for a path
>      that's already in the database.  Is that OK?

It's certainly OK. You will get a return value of
NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID for this.

And the current code treats this as an "error", (in the sense that it
will not give you a valid message object---that's reserved for a
"successful return"). There's a proposed patch here:

	id:"1288560558-18915-2-git-send-email-sojkam1 at fel.cvut.cz

that changes this so that the DUPLICATE_MESSAGE_ID case is documented as
a "successful return" and would also return a valid message object. And
that patch will likely be landing soon.

>   2) Does add_files_recursive() assume it always sees all paths?
>      i.e. is it safe to call it with just a sub-directory of the mail
>      directory?  I haven't finished investigating the code, but some
>      bits made me wonder.

From a quick scan of the code, I think this should be just fine. But do
add tests to the suite (which you are doing already, right?).

-Carl

-- 
carl.d.worth at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20101104/952961de/attachment.pgp>


More information about the notmuch mailing list