[tracker-miners/wip/carlosg/shuffle-libtracker-miner: 10/115] libtracker-miner: Check directory updates before dropping mtime info



commit f85fa15a5af0bc3fd27663c81afd52aa97bebdea
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Sep 25 12:26:33 2017 +0200

    libtracker-miner: Check directory updates before dropping mtime info
    
    file_notifier_traverse_tree() has the side effect of deleting mtime data,
    as it's presumably not needed anymore, except here. Check whether the
    directory was updated before notifying of the files inside, so we can
    thoroughly check for deleted content.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786132

 src/libtracker-miner/tracker-file-notifier.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index ca75aff95..67f42ba50 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -868,6 +868,7 @@ sparql_files_query_cb (GObject      *object,
        TrackerFileNotifierPrivate *priv;
        TrackerFileNotifier *notifier;
        TrackerSparqlCursor *cursor;
+       gboolean directory_modified;
        GError *error = NULL;
        GFile *directory;
        guint flags;
@@ -890,13 +891,15 @@ sparql_files_query_cb (GObject      *object,
                g_object_unref (cursor);
        }
 
-       file_notifier_traverse_tree (notifier, data->max_depth);
        directory = priv->current_index_root->current_dir;
        flags = priv->current_index_root->flags;
+       directory_modified = file_notifier_is_directory_modified (notifier, directory);
+
+       file_notifier_traverse_tree (notifier, data->max_depth);
 
        if ((flags & TRACKER_DIRECTORY_FLAG_CHECK_DELETED) != 0 ||
            priv->current_index_root->current_dir_content_filtered ||
-           file_notifier_is_directory_modified (notifier, directory)) {
+           directory_modified) {
                /* The directory has updated its mtime, this means something
                 * was either added or removed in the mean time. Crawling
                 * will always find all newly added files. But still, we


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]