[gnome-builder] ctags: avoid ignored directories



commit 7b61233b7f9555cc74f5dc1cdb64fa3d15c80cc7
Author: Christian Hergert <chergert redhat com>
Date:   Mon Dec 18 00:03:04 2017 -0800

    ctags: avoid ignored directories
    
    This tries harder to avoid ignored directories as determined
    by the VCS.

 src/plugins/ctags/ide-ctags-builder.c |    8 ++++++++
 src/plugins/ctags/ide-ctags-service.c |   13 +++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/ctags/ide-ctags-builder.c b/src/plugins/ctags/ide-ctags-builder.c
index f393546..28784c8 100644
--- a/src/plugins/ctags/ide-ctags-builder.c
+++ b/src/plugins/ctags/ide-ctags-builder.c
@@ -107,12 +107,17 @@ ide_ctags_builder_build (IdeCtagsBuilder *self,
   g_autofree gchar *tags_path = NULL;
   g_autoptr(GString) filenames = NULL;
   GOutputStream *stdin_stream;
+  IdeContext *context;
+  IdeVcs *vcs;
   gpointer infoptr;
 
   g_assert (IDE_IS_CTAGS_BUILDER (self));
   g_assert (G_IS_FILE (directory));
   g_assert (G_IS_FILE (destination));
 
+  context = ide_object_get_context (IDE_OBJECT (self));
+  vcs = ide_context_get_vcs (context);
+
   dest_dir = g_file_get_path (destination);
   if (0 != g_mkdir_with_parents (dest_dir, 0750))
     return FALSE;
@@ -233,6 +238,9 @@ finish_subprocess:
       g_assert (G_IS_FILE (child));
       g_assert (G_IS_FILE (dest_child));
 
+      if (ide_vcs_is_ignored (vcs, child, NULL))
+        continue;
+
       if (!ide_ctags_builder_build (self, ctags, child, dest_child, recursive, cancellable))
         return FALSE;
     }
diff --git a/src/plugins/ctags/ide-ctags-service.c b/src/plugins/ctags/ide-ctags-service.c
index 7b7cd62..d4ca066 100644
--- a/src/plugins/ctags/ide-ctags-service.c
+++ b/src/plugins/ctags/ide-ctags-service.c
@@ -278,6 +278,7 @@ ide_ctags_service_load_tags (IdeCtagsService *self,
 
 static void
 ide_ctags_service_mine_directory (IdeCtagsService *self,
+                                  IdeVcs          *vcs,
                                   GFile           *directory,
                                   gboolean         recurse,
                                   GCancellable    *cancellable)
@@ -293,6 +294,9 @@ ide_ctags_service_mine_directory (IdeCtagsService *self,
   if (g_cancellable_is_cancelled (cancellable))
     return;
 
+  if (ide_vcs_is_ignored (vcs, directory, NULL))
+    return;
+
   child = g_file_get_child (directory, "tags");
   if (g_file_query_file_type (child, 0, cancellable) == G_FILE_TYPE_REGULAR)
     ide_ctags_service_load_tags (self, child);
@@ -330,7 +334,7 @@ ide_ctags_service_mine_directory (IdeCtagsService *self,
           const gchar *name = g_file_info_get_name (file_info);
 
           child = g_file_get_child (directory, name);
-          ide_ctags_service_mine_directory (self, child, recurse, cancellable);
+          ide_ctags_service_mine_directory (self, vcs, child, recurse, cancellable);
           g_clear_object (&child);
         }
     }
@@ -347,6 +351,8 @@ ide_ctags_service_miner (GTask        *task,
                          GCancellable *cancellable)
 {
   IdeCtagsService *self = source_object;
+  IdeContext *context;
+  IdeVcs *vcs;
   GArray *mine_info = task_data;
 
   IDE_ENTRY;
@@ -355,12 +361,15 @@ ide_ctags_service_miner (GTask        *task,
   g_assert (IDE_IS_CTAGS_SERVICE (self));
   g_assert (mine_info != NULL);
 
+  context = ide_object_get_context (IDE_OBJECT (self));
+  vcs = ide_context_get_vcs (context);
+
   for (guint i = 0; i < mine_info->len; i++)
     {
       const MineInfo *info = &g_array_index (mine_info, MineInfo, i);
       g_autoptr(GFile) file = g_file_new_for_path (info->path);
 
-      ide_ctags_service_mine_directory (self, file, info->recursive, cancellable);
+      ide_ctags_service_mine_directory (self, vcs, file, info->recursive, cancellable);
     }
 
   self->miner_active = FALSE;


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