[gnome-builder] file-search: ignore symlinks



commit ea645b76e03498ac9df0d4871b4bd9539d45c929
Author: Christian Hergert <chergert redhat com>
Date:   Mon Nov 27 02:04:43 2017 -0800

    file-search: ignore symlinks
    
    https://bugzilla.gnome.org/show_bug.cgi?id=790889

 src/plugins/file-search/gb-file-search-index.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/plugins/file-search/gb-file-search-index.c b/src/plugins/file-search/gb-file-search-index.c
index 04d57cc..4b1460f 100644
--- a/src/plugins/file-search/gb-file-search-index.c
+++ b/src/plugins/file-search/gb-file-search-index.c
@@ -164,12 +164,15 @@ populate_from_dir (DzlFuzzyMutableIndex *fuzzy,
       g_autoptr(GFileInfo) file_info = file_info_ptr;
       g_autofree gchar *path = NULL;
       g_autoptr(GFile) file = NULL;
+      GFileType file_type;
       const gchar *name;
 
       name = g_file_info_get_display_name (file_info);
       file = g_file_get_child (directory, name);
 
-      if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY)
+      file_type = g_file_info_get_file_type (file_info);
+
+      if (file_type == G_FILE_TYPE_DIRECTORY)
         {
           if (children == NULL)
             children = g_ptr_array_new_with_free_func (g_object_unref);
@@ -177,6 +180,13 @@ populate_from_dir (DzlFuzzyMutableIndex *fuzzy,
           continue;
         }
 
+      /* We only want to index regular files, and ignore symlinks.  If the
+       * symlink points to something else in-tree, we'll index it in the
+       * rightful place.
+       */
+      if (file_type != G_FILE_TYPE_REGULAR)
+        continue;
+
       if (ide_vcs_is_ignored (vcs, file, NULL))
         continue;
 


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