[tracker] libtracker-miner: Avoid triggering content filters on configured roots



commit 3e040c7196624938bd81439041a1fab4970ce0c4
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Nov 9 17:13:01 2017 +0100

    libtracker-miner: Avoid triggering content filters on configured roots
    
    Folders being configured as indexing roots should win over any filter
    that might apply. The basename based filters correctly skip configured
    roots already, so do the same with the directory content filter.
    
    The practical side effect is that .git folders are now allowed on the
    directories configured in tracker-miner-fs (homedir and XDG dirs most
    usually). Tracker tries to stay out of source code trees which are a
    source of pointless grinding, but there's legit usecases to have these
    folders under git management:
    
    - User setups to bring in essential files across machines
    - Collections managed through git-annex
    
    Those are worth handling, even if the question also applies to folders
    found recursively and the .git heuristic proves limited.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=790284

 src/libtracker-miner/tracker-file-notifier.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index 8d9476b..2959f35 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -238,11 +238,19 @@ crawler_check_directory_contents_cb (TrackerCrawler *crawler,
                                      gpointer        user_data)
 {
        TrackerFileNotifierPrivate *priv;
-       gboolean process;
+       gboolean process = TRUE;
 
        priv = TRACKER_FILE_NOTIFIER (user_data)->priv;
-       process = tracker_indexing_tree_parent_is_indexable (priv->indexing_tree,
-                                                            parent, children);
+
+       /* Do not let content filter apply to configured roots themselves. This
+        * is a measure to trim undesired portions of the filesystem, and if
+        * the folder is configured to be indexed, it's clearly not undesired.
+        */
+       if (!tracker_indexing_tree_file_is_root (priv->indexing_tree, parent)) {
+               process = tracker_indexing_tree_parent_is_indexable (priv->indexing_tree,
+                                                                    parent, children);
+       }
+
        if (process) {
                TrackerDirectoryFlags parent_flags;
                gboolean add_monitor;


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