[gnome-builder] git: add workdir property for repository



commit bd0495412d9b57ffb42eeb0722b4a9f374847080
Author: Christian Hergert <chergert redhat com>
Date:   Wed Apr 10 00:24:25 2019 -0700

    git: add workdir property for repository

 src/plugins/git/daemon/ipc-git-repository-impl.c            | 8 ++++++++
 src/plugins/git/daemon/org.gnome.Builder.Git.Repository.xml | 6 ++++++
 2 files changed, 14 insertions(+)
---
diff --git a/src/plugins/git/daemon/ipc-git-repository-impl.c 
b/src/plugins/git/daemon/ipc-git-repository-impl.c
index a8aed4250..f7994b048 100644
--- a/src/plugins/git/daemon/ipc-git-repository-impl.c
+++ b/src/plugins/git/daemon/ipc-git-repository-impl.c
@@ -137,6 +137,7 @@ ipc_git_repository_impl_handle_switch_branch (IpcGitRepository      *repository,
   g_autoptr(GgitObject) obj = NULL;
   g_autoptr(GgitRef) ref = NULL;
   g_autoptr(GError) error = NULL;
+  g_autoptr(GFile) workdir = NULL;
   const gchar *shortname;
 
   g_assert (IPC_IS_GIT_REPOSITORY_IMPL (self));
@@ -155,7 +156,10 @@ ipc_git_repository_impl_handle_switch_branch (IpcGitRepository      *repository,
   if (!(shortname = ggit_ref_get_shorthand (ref)))
     shortname = "master";
 
+  workdir = ggit_repository_get_workdir (self->repository);
+
   ipc_git_repository_set_branch (repository, shortname);
+  ipc_git_repository_set_workdir (repository, g_file_peek_path (workdir));
   ipc_git_repository_complete_switch_branch (repository, invocation);
 
   ipc_git_repository_emit_changed (repository);
@@ -1058,6 +1062,7 @@ ipc_git_repository_impl_open (GFile   *location,
                               GError **error)
 {
   g_autoptr(GgitRepository) repository = NULL;
+  g_autoptr(GFile) workdir = NULL;
   g_autoptr(GFile) gitdir = NULL;
   g_autofree gchar *branch = NULL;
   IpcGitRepositoryImpl *ret;
@@ -1118,9 +1123,12 @@ ipc_git_repository_impl_open (GFile   *location,
         branch = g_strdup ("master");
     }
 
+  workdir = ggit_repository_get_workdir (repository);
+
   ret = g_object_new (IPC_TYPE_GIT_REPOSITORY_IMPL,
                       "branch", branch,
                       "location", g_file_peek_path (location),
+                      "workdir", g_file_peek_path (workdir),
                       NULL);
   ret->repository = g_steal_pointer (&repository);
   ret->monitor = ipc_git_index_monitor_new (location);
diff --git a/src/plugins/git/daemon/org.gnome.Builder.Git.Repository.xml 
b/src/plugins/git/daemon/org.gnome.Builder.Git.Repository.xml
index 5ec8d83c0..2d1c4956a 100644
--- a/src/plugins/git/daemon/org.gnome.Builder.Git.Repository.xml
+++ b/src/plugins/git/daemon/org.gnome.Builder.Git.Repository.xml
@@ -46,6 +46,12 @@
       The location of the .git directory for the repository.
     -->
     <property name="Location" type="ay" access="read"/>
+    <!--
+      Workdir:
+
+      The path to the working directory of the repository.
+    -->
+    <property name="Workdir" type="ay" access="read"/>
     <!--
       Close:
 


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