]> git.notmuchmail.org Git - notmuch/commit
cli: strip trailing "/" from the final maildir path in notmuch insert
authorJani Nikula <jani@nikula.org>
Sun, 1 Oct 2017 20:53:10 +0000 (23:53 +0300)
committerDavid Bremner <david@tethera.net>
Thu, 5 Oct 2017 01:00:19 +0000 (22:00 -0300)
commitd57da17fcd30a5cbe191ccd42906e489dd2bd6a3
tree64b5ec6309eac48b23c076450a3abe1b7a914679
parent9d48ee2eaacce7323622e6017f7bdb01a915e885
cli: strip trailing "/" from the final maildir path in notmuch insert

Several subtle interconnected changes here:

- If the folder name passed as argument is the empty string "" or
  slash "/", the final maildir path would end up having "//" in it. We
  should strip the final maildir path, not folder.

- The folder variable should really be const char *, another reason
  not to modify it.

- The maildir variable is only const to let us point it at db_path
  directly.

To be able to strip the maildir variable, always allocate it. Default
folder to the empty string "", and don't treat folder not being
present on the command line as anything special.

As a side effect, we also create the cur/new/tmp in the top level
directory if they're not there and --create-folder is given.
notmuch-insert.c