[gnome-builder] buildsystem: use branch in builddir path



commit 5cd74a05847139916a0730e280721b4a00e61f13
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jan 10 21:01:48 2018 -0800

    buildsystem: use branch in builddir path
    
    If the build system didn't override the build directory, make sure we take
    the branch into account for the builddir. This helps avoid stomping over
    each other when two workbench windows are open with different branches.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=792383

 src/libide/buildsystem/ide-build-system.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/libide/buildsystem/ide-build-system.c b/src/libide/buildsystem/ide-build-system.c
index 707e4b4..2894692 100644
--- a/src/libide/buildsystem/ide-build-system.c
+++ b/src/libide/buildsystem/ide-build-system.c
@@ -30,6 +30,7 @@
 #include "buildsystem/ide-configuration.h"
 #include "files/ide-file.h"
 #include "projects/ide-project.h"
+#include "vcs/ide-vcs.h"
 
 G_DEFINE_INTERFACE (IdeBuildSystem, ide_build_system, IDE_TYPE_OBJECT)
 
@@ -532,18 +533,28 @@ ide_build_system_get_builddir (IdeBuildSystem   *self,
   if (ret == NULL)
     {
       g_autofree gchar *name = NULL;
+      g_autofree gchar *branch = NULL;
       const gchar *config_id;
       const gchar *device_id;
       const gchar *runtime_id;
       IdeContext *context;
+      IdeVcs *vcs;
 
       context = ide_object_get_context (IDE_OBJECT (self));
+      vcs = ide_context_get_vcs (context);
+
       config_id = ide_configuration_get_id (configuration);
       device_id = ide_configuration_get_device_id (configuration);
       runtime_id = ide_configuration_get_runtime_id (configuration);
+      branch = ide_vcs_get_branch_name (vcs);
+
+      if (branch != NULL)
+        name = g_strdup_printf ("%s-%s-%s-%s", config_id, device_id, runtime_id, branch);
+      else
+        name = g_strdup_printf ("%s-%s-%s", config_id, device_id, runtime_id);
+
+      g_strdelimit (name, "@:/", '-');
 
-      name = g_strdelimit (g_strdup_printf ("%s-%s-%s", config_id, device_id, runtime_id),
-                           "@:/", '-');
       ret = ide_context_cache_filename (context, "builds", name, NULL);
     }
 


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