From ed7a970ee6f56057584b70f5dd6a1ba5cb344e5f Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Thu, 1 May 2014 08:04:44 +0200 Subject: [PATCH] recollindex: allow passing -e -i for erasing index data before rebuilding --- src/index/recollindex.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/index/recollindex.cpp b/src/index/recollindex.cpp index 620b74c0..9d106b6b 100644 --- a/src/index/recollindex.cpp +++ b/src/index/recollindex.cpp @@ -448,11 +448,17 @@ int main(int argc, char **argv) filenames.push_back(*argv++); } } - bool status; - if (op_flags & OPT_i) - status = indexfiles(config, filenames); - else + + // Note that -e and -i may be both set. In this case we first erase, + // then index. This is a slightly different from -Z -i because we + // warranty that all subdocs are purged. + bool status = true; + if (op_flags & OPT_e) { status = purgefiles(config, filenames); + } + if (status && (op_flags & OPT_i)) { + status = indexfiles(config, filenames); + } if (confindexer && !confindexer->getReason().empty()) cerr << confindexer->getReason() << endl; exit(status ? 0 : 1);