[gnome-builder/wip/libide] git: track if a IdeProjectFile is a directory in GFileInfo



commit 8e2a177b2f6403fdf995f076258770b5517cfe15
Author: Christian Hergert <christian hergert me>
Date:   Sat Feb 7 13:52:07 2015 -0800

    git: track if a IdeProjectFile is a directory in GFileInfo
    
    We should probably extend this to track if a file is a symlink or other
    special value from the git index.

 libide/git/ide-git-vcs.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/libide/git/ide-git-vcs.c b/libide/git/ide-git-vcs.c
index 43934be..458b5e7 100644
--- a/libide/git/ide-git-vcs.c
+++ b/libide/git/ide-git-vcs.c
@@ -111,7 +111,8 @@ ide_git_vcs_init (IdeGitVcs *self)
 static void
 ide_git_vcs_reload_index_add_path (IdeGitVcs   *self,
                                    GHashTable  *cache,
-                                   const gchar *path)
+                                   const gchar *path,
+                                   gboolean     is_directory)
 {
   IdeProjectItem *parent;
   IdeProjectItem *item;
@@ -133,7 +134,7 @@ ide_git_vcs_reload_index_add_path (IdeGitVcs   *self,
 
   if (!parent)
     {
-      ide_git_vcs_reload_index_add_path (self, cache, dir);
+      ide_git_vcs_reload_index_add_path (self, cache, dir, TRUE);
       parent = g_hash_table_lookup (cache, dir);
     }
 
@@ -143,6 +144,15 @@ ide_git_vcs_reload_index_add_path (IdeGitVcs   *self,
   g_file_info_set_name (file_info, name);
   g_file_info_set_display_name (file_info, name);
 
+  /*
+   * TODO: We can probably extract some additional information from the
+   *       index such as symbolic link, etc.
+   */
+  if (is_directory)
+    {
+      g_file_info_set_file_type (file_info, G_FILE_TYPE_DIRECTORY);
+    }
+
   item = g_object_new (IDE_TYPE_PROJECT_FILE,
                        "context", context,
                        "parent", parent,
@@ -207,7 +217,7 @@ ide_git_vcs_reload_index (IdeGitVcs  *self,
       entry = ggit_index_entries_get_by_index (entries, i);
       path = ggit_index_entry_get_path (entry);
 
-      ide_git_vcs_reload_index_add_path (self, cache, path);
+      ide_git_vcs_reload_index_add_path (self, cache, path, FALSE);
 
       ggit_index_entry_unref (entry);
     }


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