[gnome-builder] git: handle relative paths from gitdir



commit a80ca01093c5ad2e62216af89ea73e11a1ebed37
Author: Christian Hergert <chergert redhat com>
Date:   Thu Sep 27 14:06:16 2018 -0700

    git: handle relative paths from gitdir

 src/plugins/git/ide-git-vcs.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/git/ide-git-vcs.c b/src/plugins/git/ide-git-vcs.c
index 33f539290..bf7f9c583 100644
--- a/src/plugins/git/ide-git-vcs.c
+++ b/src/plugins/git/ide-git-vcs.c
@@ -278,10 +278,16 @@ ide_git_vcs_load (IdeGitVcs  *self,
 
               if (g_str_has_prefix (line, "gitdir: "))
                 {
+                  g_autoptr(GFile) location_parent = g_file_get_parent (location);
+                  const gchar *path = line + strlen ("gitdir: ");
                   const gchar *branch;
 
                   g_clear_object (&location);
-                  location = g_file_new_for_path (line + strlen ("gitdir: "));
+
+                  if (g_path_is_absolute (path))
+                    location = g_file_new_for_path (path);
+                  else
+                    location = g_file_resolve_relative_path (location_parent, path);
 
                   /*
                    * Worktrees only have a single branch, and it is the name


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