* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
case NOTMUCH_STATUS_FILE_NOT_EMAIL:
fprintf (stderr, "Note: Ignoring non-mail file: %s\n", filename);
break;
case NOTMUCH_STATUS_FILE_NOT_EMAIL:
fprintf (stderr, "Note: Ignoring non-mail file: %s\n", filename);
break;
+ case NOTMUCH_STATUS_FILE_ERROR:
+ /* Someone renamed/removed the file between scandir and now. */
+ state->vanished_files++;
+ fprintf (stderr, "Unexpected error with file %s\n", filename);
+ (void) print_status_database ("add_file", notmuch, status);
+ break;
/* Fatal issues. Don't process anymore. */
case NOTMUCH_STATUS_READ_ONLY_DATABASE:
case NOTMUCH_STATUS_XAPIAN_EXCEPTION:
/* Fatal issues. Don't process anymore. */
case NOTMUCH_STATUS_READ_ONLY_DATABASE:
case NOTMUCH_STATUS_XAPIAN_EXCEPTION:
struct dirent *entry = NULL;
char *next = NULL;
time_t fs_mtime, db_mtime;
struct dirent *entry = NULL;
char *next = NULL;
time_t fs_mtime, db_mtime;
/* Ignore files & directories user has configured to be ignored */
if (_entry_in_ignore_list (entry->d_name, state)) {
if (state->debug)
/* Ignore files & directories user has configured to be ignored */
if (_entry_in_ignore_list (entry->d_name, state)) {
if (state->debug)
char *absolute = talloc_asprintf (state->removed_directories,
"%s/%s", path, filename);
if (state->debug)
char *absolute = talloc_asprintf (state->removed_directories,
"%s/%s", path, filename);
if (state->debug)
*/
if (strcmp (entry->d_name, ".") == 0 ||
strcmp (entry->d_name, "..") == 0 ||
*/
if (strcmp (entry->d_name, ".") == 0 ||
strcmp (entry->d_name, "..") == 0 ||
- strcmp (entry->d_name, ".notmuch") == 0 ||
- _entry_in_ignore_list (entry->d_name, state))
- {
- if (state->debug && _entry_in_ignore_list (entry->d_name, state))
+ strcmp (entry->d_name, ".notmuch") == 0)
+ continue;
+
+ /* Ignore any files/directories the user has configured to be
+ * ignored
+ */
+ if (_entry_in_ignore_list (entry->d_name, state)) {
+ if (state->debug)
state->processed_files == 1 ? "file" : "total files");
notmuch_time_print_formatted_seconds (elapsed);
if (elapsed > 1)
state->processed_files == 1 ? "file" : "total files");
notmuch_time_print_formatted_seconds (elapsed);
if (elapsed > 1)
notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
{
notmuch_database_t *notmuch;
notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
{
notmuch_database_t *notmuch;
- add_files_state_t add_files_state;
+ add_files_state_t add_files_state = {
+ .verbosity = VERBOSITY_NORMAL,
+ .debug = FALSE,
+ .output_is_a_tty = isatty (fileno (stdout)),
+ };
notmuch_opt_desc_t options[] = {
{ NOTMUCH_OPT_BOOLEAN, &quiet, "quiet", 'q', 0 },
{ NOTMUCH_OPT_BOOLEAN, &verbose, "verbose", 'v', 0 },
notmuch_opt_desc_t options[] = {
{ NOTMUCH_OPT_BOOLEAN, &quiet, "quiet", 'q', 0 },
{ NOTMUCH_OPT_BOOLEAN, &verbose, "verbose", 'v', 0 },
}
if (notmuch_database_dump (notmuch, backup_name, "",
}
if (notmuch_database_dump (notmuch, backup_name, "",
gettimeofday (&add_files_state.tv_start, NULL);
add_files_state.removed_files = _filename_list_create (config);
gettimeofday (&add_files_state.tv_start, NULL);
add_files_state.removed_files = _filename_list_create (config);
if (!no_hooks && !ret && !interrupted)
ret = notmuch_run_hook (db_path, "post-new");
if (!no_hooks && !ret && !interrupted)
ret = notmuch_run_hook (db_path, "post-new");