* 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
elapsed_overall = notmuch_time_elapsed (tv_start, tv_now);
rate_overall = processed / elapsed_overall;
elapsed_overall = notmuch_time_elapsed (tv_start, tv_now);
rate_overall = processed / elapsed_overall;
if (processed > 0 && elapsed_overall > 0.5) {
double time_remaining = ((total - processed) / rate_overall);
printf (" (");
if (processed > 0 && elapsed_overall > 0.5) {
double time_remaining = ((total - processed) / rate_overall);
printf (" (");
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:
case NOTMUCH_STATUS_OUT_OF_MEMORY:
/* Fatal issues. Don't process anymore. */
case NOTMUCH_STATUS_READ_ONLY_DATABASE:
case NOTMUCH_STATUS_XAPIAN_EXCEPTION:
case NOTMUCH_STATUS_OUT_OF_MEMORY:
- fprintf (stderr, "Error: %s. Halting processing.\n",
- notmuch_status_to_string (status));
+ (void) print_status_database("add_file", notmuch, status);
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)
_filename_list_add (state->removed_files, absolute);
notmuch_filenames_move_to_next (db_files);
_filename_list_add (state->removed_files, absolute);
notmuch_filenames_move_to_next (db_files);
{
char *absolute = talloc_asprintf (state->removed_directories,
"%s/%s", path, filename);
{
char *absolute = talloc_asprintf (state->removed_directories,
"%s/%s", path, filename);
char *absolute = talloc_asprintf (state->removed_files,
"%s/%s", path,
notmuch_filenames_get (db_files));
char *absolute = talloc_asprintf (state->removed_files,
"%s/%s", path,
notmuch_filenames_get (db_files));
_filename_list_add (state->removed_directories, absolute);
notmuch_filenames_move_to_next (db_subdirs);
_filename_list_add (state->removed_directories, absolute);
notmuch_filenames_move_to_next (db_subdirs);
*/
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)
notmuch_directory_t *directory;
notmuch_filenames_t *files, *subdirs;
char *absolute;
notmuch_directory_t *directory;
notmuch_filenames_t *files, *subdirs;
char *absolute;
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_needs_upgrade (notmuch)) {
time_t now = time (NULL);
struct tm *gm_time = gmtime (&now);
if (notmuch_database_needs_upgrade (notmuch)) {
time_t now = time (NULL);
struct tm *gm_time = gmtime (&now);
}
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");