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



commit d0bd81bbb2d39433a27e3724e639499bd22d66c6
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]