[gnome-builder] git/daemon: Update "branch" property when we receive index change signal



commit 6d2d0f4efe6b6ef572914e8d402af78e62b8ebbe
Author: vanadiae <vanadiae35 gmail com>
Date:   Fri Aug 6 21:02:28 2021 +0200

    git/daemon: Update "branch" property when we receive index change signal
    
    Fixes #1490

 src/plugins/git/daemon/ipc-git-repository-impl.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/src/plugins/git/daemon/ipc-git-repository-impl.c 
b/src/plugins/git/daemon/ipc-git-repository-impl.c
index 27b06ab7b..50f5d9c2b 100644
--- a/src/plugins/git/daemon/ipc-git-repository-impl.c
+++ b/src/plugins/git/daemon/ipc-git-repository-impl.c
@@ -66,6 +66,7 @@ ipc_git_repository_impl_monitor_changed_cb (IpcGitRepositoryImpl *self,
 {
   GHashTableIter iter;
   gpointer key;
+  g_autoptr(GgitRef) head_ref = NULL;
 
   g_assert (IPC_IS_GIT_REPOSITORY_IMPL (self));
   g_assert (IPC_IS_GIT_INDEX_MONITOR (monitor));
@@ -78,6 +79,9 @@ ipc_git_repository_impl_monitor_changed_cb (IpcGitRepositoryImpl *self,
       ipc_git_change_monitor_impl_reset (change_monitor);
     }
 
+  head_ref = ggit_repository_get_head (self->repository, NULL);
+  g_assert (GGIT_IS_REF (head_ref));
+  ipc_git_repository_set_branch ((IpcGitRepository *)self, ggit_ref_get_shorthand (head_ref));
   ipc_git_repository_emit_changed (IPC_GIT_REPOSITORY (self));
 }
 


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