[tracker-miners/wip/carlosg/speed-track: 16/40] libtracker-miner: Drop tracker_file_notifier_ensure_parents()




commit 730c9e6f469e89480001e7ba6aba1d52afc9e04b
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Oct 4 21:48:54 2020 +0200

    libtracker-miner: Drop tracker_file_notifier_ensure_parents()
    
    This is supposed to happen with MONITOR | !CHECK_TIME. Luckily or
    not, !CHECK_MTIME is currently broken (doubly! in handling, and in
    setting it), anyhow this flag shouldn't mean "ignore newly found
    files/directories", when fixed in future commits.
    
    Drop this, we should really issue ::file-created from the regular
    paths.

 src/libtracker-miner/tracker-file-notifier.c       | 42 ----------------------
 .../libtracker-miner/tracker-file-notifier-test.c  |  2 --
 2 files changed, 44 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index 7ca355e9b..e6d4a3694 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -893,44 +893,6 @@ notifier_queue_root (TrackerFileNotifier   *notifier,
                notifier_check_next_root (notifier);
 }
 
-/* This function ensures to issue ::file-created for all
- * parent folders that are not yet indexed. Shouldn't happen
- * often, it is however possible if MONITOR | !CHECK_MTIME is
- * given, and file updates happen on a not previously indexed
- * directory.
- */
-static void
-tracker_file_notifier_ensure_parents (TrackerFileNotifier *notifier,
-                                      GFile               *file)
-{
-       TrackerFileNotifierPrivate *priv;
-       GFile *parent, *canonical;
-
-       priv = tracker_file_notifier_get_instance_private (notifier);
-       parent = g_file_get_parent (file);
-
-       while (parent) {
-               if (tracker_file_notifier_get_file_iri (notifier, parent, TRUE)) {
-                       g_object_unref (parent);
-                       break;
-               }
-
-               canonical = tracker_file_system_get_file (priv->file_system,
-                                                         parent,
-                                                         G_FILE_TYPE_DIRECTORY,
-                                                         NULL);
-               g_object_unref (parent);
-
-               g_signal_emit (notifier, signals[FILE_CREATED], 0, canonical, TRUE);
-
-               if (tracker_indexing_tree_file_is_root (priv->indexing_tree, canonical)) {
-                       break;
-               }
-
-               parent = g_file_get_parent (canonical);
-       }
-}
-
 /* Monitor signal handlers */
 static void
 monitor_item_created_cb (TrackerMonitor *monitor,
@@ -1016,8 +978,6 @@ monitor_item_created_cb (TrackerMonitor *monitor,
                }
        }
 
-       tracker_file_notifier_ensure_parents (notifier, file);
-
        /* Fetch the interned copy */
        canonical = tracker_file_system_get_file (priv->file_system,
                                                  file, file_type, NULL);
@@ -1050,8 +1010,6 @@ monitor_item_updated_cb (TrackerMonitor *monitor,
                return;
        }
 
-       tracker_file_notifier_ensure_parents (notifier, file);
-
        /* Fetch the interned copy */
        canonical = tracker_file_system_get_file (priv->file_system,
                                                  file, file_type, NULL);
diff --git a/tests/libtracker-miner/tracker-file-notifier-test.c 
b/tests/libtracker-miner/tracker-file-notifier-test.c
index 86b0785ab..cc78e48b3 100644
--- a/tests/libtracker-miner/tracker-file-notifier-test.c
+++ b/tests/libtracker-miner/tracker-file-notifier-test.c
@@ -673,7 +673,6 @@ test_file_notifier_monitor_updates_non_recursive (TestCommonContext *fixture,
                { OPERATION_CREATE, "non-recursive/bbb", NULL }
        };
        FilesystemOperation expected_results2[] = {
-               { OPERATION_CREATE, "non-recursive", NULL },
                { OPERATION_UPDATE, "non-recursive/bbb", NULL },
                { OPERATION_CREATE, "non-recursive/ccc", NULL },
                { OPERATION_UPDATE, "non-recursive/ccc", NULL }
@@ -722,7 +721,6 @@ test_file_notifier_monitor_updates_recursive (TestCommonContext *fixture,
                { OPERATION_CREATE, "recursive/bbb", NULL }
        };
        FilesystemOperation expected_results2[] = {
-               { OPERATION_CREATE, "recursive", NULL },
                { OPERATION_CREATE, "recursive/folder", NULL },
                { OPERATION_CREATE, "recursive/folder/aaa", NULL },
                { OPERATION_UPDATE, "recursive/bbb", NULL },


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