From 29908b9f1375904957e754531912d4ad12e94e74 Mon Sep 17 00:00:00 2001
From: Carl Worth <cworth@cworth.org>
Date: Tue, 5 Jan 2010 15:23:52 -0800
Subject: [PATCH] notmuch new: Avoid updating directory timestamp if
 interrupted.

This was a very dangerous bug. An interrupted "notmuch new" session
would still update the timestamp for the directory in the
database. This would result in mail files that were not processed due
to the original interruption *never* being picked up by future runs of
"notmuch new". Yikes!
---
 notmuch-new.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/notmuch-new.c b/notmuch-new.c
index ca68a684..4adbdc7f 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -290,9 +290,11 @@ add_files_recursive (notmuch_database_t *notmuch,
 	next = NULL;
     }
 
-    status = notmuch_directory_set_mtime (directory, path_mtime);
-    if (status && ret == NOTMUCH_STATUS_SUCCESS)
-	ret = status;
+    if (! interrupted) {
+	status = notmuch_directory_set_mtime (directory, path_mtime);
+	if (status && ret == NOTMUCH_STATUS_SUCCESS)
+	    ret = status;
+    }
 
   DONE:
     if (next)
-- 
2.45.2