return 0;
}
- if (index->index_deleted) {
+ if (index->index_deleted &&
+ (flags & MAIL_INDEX_SYNC_FLAG_DELETING_INDEX) == 0) {
/* index is already deleted. we can't sync. */
if (locked)
mail_transaction_log_sync_unlock(index->log);
trans_flags |= MAIL_INDEX_TRANSACTION_FLAG_FSYNC;
ctx->ext_trans = mail_index_transaction_begin(ctx->view, trans_flags);
ctx->ext_trans->sync_transaction = TRUE;
+ ctx->ext_trans->commit_deleted_index =
+ (flags & MAIL_INDEX_SYNC_FLAG_DELETING_INDEX) != 0;
*ctx_r = ctx;
*view_r = ctx->view;
unsigned int reset:1;
unsigned int index_deleted:1;
unsigned int index_undeleted:1;
+ unsigned int commit_deleted_index:1;
/* non-extension updates. flag updates don't change this because
they may be added and removed, so be sure to check that the updates
array is non-empty also. */
mail_index_transaction_rollback(_t);
return -1;
}
- if (!index_undeleted) {
+ if (!index_undeleted && !t->commit_deleted_index) {
if (t->view->index->index_deleted ||
(t->view->index->index_delete_requested &&
!t->view->index->syncing)) {