summaryrefslogtreecommitdiff
path: root/mu
diff options
context:
space:
mode:
authordjcb <djcb@djcbsoftware.nl>2016-07-23 19:18:09 +0300
committerdjcb <djcb@djcbsoftware.nl>2016-07-23 21:33:10 +0300
commit9477071e63f96d95f6afb4e61cbe288ee0d3dbef (patch)
treef002cb7b0b4b81322a18f9b54afa84368e14187c /mu
parent2a83b02ce2efd63f9e9b93fae5b783ddc3deed75 (diff)
mu: add '--lazy-check' option for indexing
Add an option --lazy-check to ignore any directories that don't have their ctime changed since the last indexing operation. There are a few corner-cases (such as editing a message outside mu's control) where this might miss a change, but apart from that, makes indexing in for a maildir (and its sub-maildirs) almost a no-op if there were no changes.
Diffstat (limited to 'mu')
-rw-r--r--mu/mu-cmd-index.c25
-rw-r--r--mu/mu-config.c4
-rw-r--r--mu/mu-config.h2
3 files changed, 18 insertions, 13 deletions
diff --git a/mu/mu-cmd-index.c b/mu/mu-cmd-index.c
index 8a3364f..249f778 100644
--- a/mu/mu-cmd-index.c
+++ b/mu/mu-cmd-index.c
@@ -1,7 +1,7 @@
/* -*-mode: c; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-*/
/*
-** Copyright (C) 2008-2013 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
+** Copyright (C) 2008-2016 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
@@ -49,24 +49,24 @@ sig_handler (int sig)
"press again to kill immediately");
}
- MU_CAUGHT_SIGNAL = TRUE;
+ MU_CAUGHT_SIGNAL = TRUE;
}
static void
install_sig_handler (void)
{
- struct sigaction action;
- int i, sigs[] = { SIGINT, SIGHUP, SIGTERM };
+ struct sigaction action;
+ int i, sigs[] = { SIGINT, SIGHUP, SIGTERM };
- MU_CAUGHT_SIGNAL = FALSE;
+ MU_CAUGHT_SIGNAL = FALSE;
- action.sa_handler = sig_handler;
- sigemptyset(&action.sa_mask);
- action.sa_flags = SA_RESETHAND;
+ action.sa_handler = sig_handler;
+ sigemptyset(&action.sa_mask);
+ action.sa_flags = SA_RESETHAND;
- for (i = 0; i != G_N_ELEMENTS(sigs); ++i)
- if (sigaction (sigs[i], &action, NULL) != 0)
- g_critical ("set sigaction for %d failed: %s",
+ for (i = 0; i != G_N_ELEMENTS(sigs); ++i)
+ if (sigaction (sigs[i], &action, NULL) != 0)
+ g_critical ("set sigaction for %d failed: %s",
sigs[i], strerror (errno));;
}
@@ -319,7 +319,8 @@ cmd_index (MuIndex *midx, MuConfig *opts, MuIndexStats *stats, GError **err)
newline_before_on();
- rv = mu_index_run (midx, opts->maildir, opts->rebuild, stats,
+ rv = mu_index_run (midx, opts->maildir, opts->rebuild,
+ opts->lazycheck, stats,
show_progress ?
(MuIndexMsgCallback)index_msg_cb :
(MuIndexMsgCallback)index_msg_silent_cb,
diff --git a/mu/mu-config.c b/mu/mu-config.c
index 5af1ccb..0e3fd5e 100644
--- a/mu/mu-config.c
+++ b/mu/mu-config.c
@@ -148,6 +148,8 @@ config_options_group_index (void)
"top of the maildir", "<maildir>"},
{"rebuild", 0, 0, G_OPTION_ARG_NONE, &MU_CONFIG.rebuild,
"rebuild the database from scratch (false)", NULL},
+ {"lazy-check", 0, 0, G_OPTION_ARG_NONE, &MU_CONFIG.lazycheck,
+ "only check dir-timestamps (false)", NULL},
{"my-address", 0, 0, G_OPTION_ARG_STRING_ARRAY,
&MU_CONFIG.my_addresses,
"my e-mail address (regexp); can be used multiple times",
@@ -307,7 +309,7 @@ config_options_group_script (void)
GOptionEntry entries[] = {
{G_OPTION_REMAINING, 0,0, G_OPTION_ARG_STRING_ARRAY,
&MU_CONFIG.params, "script parameters", NULL},
- {NULL, 0, 0, 0, NULL, NULL, NULL}
+ {NULL, 0, 0, 0, NULL, NULL, NULL}
};
og = g_option_group_new("script", "Options for the 'script' command",
diff --git a/mu/mu-config.h b/mu/mu-config.h
index a45072a..d457416 100644
--- a/mu/mu-config.h
+++ b/mu/mu-config.h
@@ -112,6 +112,8 @@ struct _MuConfig {
gboolean rebuild; /* empty the database before indexing */
gboolean autoupgrade; /* automatically upgrade db
* when needed */
+ gboolean lazycheck; /* don't check dirs with up-to-date
+ * timestamps */
int xbatchsize; /* batchsize for xapian
* commits, or 0 for
* default */