tracker r2706 - in trunk: . src/libtracker-common src/trackerd tests/libtracker-common
- From: mr svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2706 - in trunk: . src/libtracker-common src/trackerd tests/libtracker-common
- Date: Tue, 16 Dec 2008 11:30:41 +0000 (UTC)
Author: mr
Date: Tue Dec 16 11:30:41 2008
New Revision: 2706
URL: http://svn.gnome.org/viewvc/tracker?rev=2706&view=rev
Log:
* src/libtracker-common/tracker-config.c:
* src/libtracker-common/tracker-file-utils.[ch]:
* src/trackerd/tracker-crawler.c:
* tests/libtracker-common/tracker-file-utils-test.c: In function
tracker_path_list_filter_duplicates(), don't filter basenames
which have a particular prefix. This prefix is currently always
"." but can be specified.
Modified:
trunk/ChangeLog
trunk/src/libtracker-common/tracker-config.c
trunk/src/libtracker-common/tracker-file-utils.c
trunk/src/libtracker-common/tracker-file-utils.h
trunk/src/trackerd/tracker-crawler.c
trunk/tests/libtracker-common/tracker-file-utils-test.c
Modified: trunk/src/libtracker-common/tracker-config.c
==============================================================================
--- trunk/src/libtracker-common/tracker-config.c (original)
+++ trunk/src/libtracker-common/tracker-config.c Tue Dec 16 11:30:41 2008
@@ -1086,13 +1086,13 @@
l = config_string_list_to_gslist ((const gchar **) value, is_directory_list);
if (strcmp (property, "watch-directory-roots") == 0) {
- priv->watch_directory_roots = tracker_path_list_filter_duplicates (l);
+ priv->watch_directory_roots = tracker_path_list_filter_duplicates (l, ".");
}
else if (strcmp (property, "crawl-directory-roots") == 0) {
- priv->crawl_directory_roots = tracker_path_list_filter_duplicates (l);
+ priv->crawl_directory_roots = tracker_path_list_filter_duplicates (l, ".");
}
else if (strcmp (property, "no-watch-directory-roots") == 0) {
- priv->no_watch_directory_roots = tracker_path_list_filter_duplicates (l);
+ priv->no_watch_directory_roots = tracker_path_list_filter_duplicates (l, ".");
}
else if (strcmp (property, "no-index-file-types") == 0) {
priv->no_index_file_types = l;
@@ -2298,7 +2298,7 @@
l = priv->watch_directory_roots;
priv->watch_directory_roots =
- tracker_path_list_filter_duplicates (priv->watch_directory_roots);
+ tracker_path_list_filter_duplicates (priv->watch_directory_roots, ".");
g_slist_foreach (l, (GFunc) g_free, NULL);
g_slist_free (l);
@@ -2334,7 +2334,7 @@
l = priv->crawl_directory_roots;
priv->crawl_directory_roots =
- tracker_path_list_filter_duplicates (priv->crawl_directory_roots);
+ tracker_path_list_filter_duplicates (priv->crawl_directory_roots, ".");
g_slist_foreach (l, (GFunc) g_free, NULL);
g_slist_free (l);
@@ -2370,7 +2370,7 @@
l = priv->no_watch_directory_roots;
priv->no_watch_directory_roots =
- tracker_path_list_filter_duplicates (priv->no_watch_directory_roots);
+ tracker_path_list_filter_duplicates (priv->no_watch_directory_roots, ".");
g_slist_foreach (l, (GFunc) g_free, NULL);
g_slist_free (l);
Modified: trunk/src/libtracker-common/tracker-file-utils.c
==============================================================================
--- trunk/src/libtracker-common/tracker-file-utils.c (original)
+++ trunk/src/libtracker-common/tracker-file-utils.c Tue Dec 16 11:30:41 2008
@@ -544,7 +544,8 @@
}
GSList *
-tracker_path_list_filter_duplicates (GSList *roots)
+tracker_path_list_filter_duplicates (GSList *roots,
+ const gchar *basename_exception_prefix)
{
GSList *l1, *l2;
GSList *new_list;
@@ -568,8 +569,38 @@
if (path == in_path) {
/* Do nothing */
+ l2 = l2->next;
+ continue;
}
- else if (tracker_path_is_in_path (path, in_path)) {
+
+ if (basename_exception_prefix) {
+ gchar *basename;
+ gboolean has_prefix = FALSE;
+
+ basename = g_path_get_basename (path);
+ if (!g_str_has_prefix (basename, basename_exception_prefix)) {
+ g_free (basename);
+
+ basename = g_path_get_basename (in_path);
+ if (g_str_has_prefix (basename, basename_exception_prefix)) {
+ has_prefix = TRUE;
+ }
+ } else {
+ has_prefix = TRUE;
+ }
+
+ g_free (basename);
+
+ /* This is so we can ignore this check
+ * on files which prefix with ".".
+ */
+ if (has_prefix) {
+ l2 = l2->next;
+ continue;
+ }
+ }
+
+ if (tracker_path_is_in_path (path, in_path)) {
g_debug ("Removing path:'%s', it is in path:'%s'",
path, in_path);
Modified: trunk/src/libtracker-common/tracker-file-utils.h
==============================================================================
--- trunk/src/libtracker-common/tracker-file-utils.h (original)
+++ trunk/src/libtracker-common/tracker-file-utils.h Tue Dec 16 11:30:41 2008
@@ -46,7 +46,8 @@
gboolean tracker_path_is_in_path (const gchar *path,
const gchar *in_path);
void tracker_path_hash_table_filter_duplicates (GHashTable *roots);
-GSList * tracker_path_list_filter_duplicates (GSList *roots);
+GSList * tracker_path_list_filter_duplicates (GSList *roots,
+ const gchar *basename_exception_prefix);
gchar * tracker_path_evaluate_name (const gchar *uri);
gboolean tracker_env_check_xdg_dirs (void);
Modified: trunk/src/trackerd/tracker-crawler.c
==============================================================================
--- trunk/src/trackerd/tracker-crawler.c (original)
+++ trunk/src/trackerd/tracker-crawler.c Tue Dec 16 11:30:41 2008
@@ -900,20 +900,17 @@
/* Filter duplicates */
l = priv->paths;
- priv->paths = tracker_path_list_filter_duplicates (priv->paths);
-
+ priv->paths = tracker_path_list_filter_duplicates (priv->paths, ".");
g_slist_foreach (l, (GFunc) g_free, NULL);
g_slist_free (l);
l = priv->recurse_paths;
- priv->recurse_paths = tracker_path_list_filter_duplicates (priv->recurse_paths);
-
+ priv->recurse_paths = tracker_path_list_filter_duplicates (priv->recurse_paths, ".");
g_slist_foreach (l, (GFunc) g_free, NULL);
g_slist_free (l);
l = priv->special_paths;
- priv->special_paths = tracker_path_list_filter_duplicates (priv->special_paths);
-
+ priv->special_paths = tracker_path_list_filter_duplicates (priv->special_paths, ".");
g_slist_foreach (l, (GFunc) g_free, NULL);
g_slist_free (l);
Modified: trunk/tests/libtracker-common/tracker-file-utils-test.c
==============================================================================
--- trunk/tests/libtracker-common/tracker-file-utils-test.c (original)
+++ trunk/tests/libtracker-common/tracker-file-utils-test.c Tue Dec 16 11:30:41 2008
@@ -64,8 +64,7 @@
input_as_list = array_as_list (input_roots);
-
- result = tracker_path_list_filter_duplicates (input_as_list);
+ result = tracker_path_list_filter_duplicates (input_as_list, ".");
g_assert_cmpint (3, ==, g_slist_length (result));
g_assert (string_in_list (result, "/home"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]