[gnome-builder] git: avoid drawing "add" lines between repository load and blob load



commit 53f28839174e8523351a613a4548d5b3143c0d5a
Author: Christian Hergert <christian hergert me>
Date:   Wed Dec 24 23:06:59 2014 -0800

    git: avoid drawing "add" lines between repository load and blob load

 src/editor/gb-source-change-monitor.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/editor/gb-source-change-monitor.c b/src/editor/gb-source-change-monitor.c
index 61c41fd..4222e67 100644
--- a/src/editor/gb-source-change-monitor.c
+++ b/src/editor/gb-source-change-monitor.c
@@ -41,6 +41,8 @@ struct _GbSourceChangeMonitorPrivate
 
   guint           changed_handler;
   guint           parse_timeout;
+
+  gint            found_blob;
 };
 
 enum
@@ -92,7 +94,7 @@ gb_source_change_monitor_get_line (GbSourceChangeMonitor *monitor,
    * possibly just a new file in the repository. Mark the line as
    * added.
    */
-  if (monitor->priv->repo)
+  if (monitor->priv->repo && (monitor->priv->found_blob == 0))
     return GB_SOURCE_CHANGE_ADDED;
 
   return GB_SOURCE_CHANGE_NONE;
@@ -414,6 +416,9 @@ cleanup:
     g_task_return_new_error (task, G_FILE_ERROR, G_FILE_ERROR_NOENT,
                              _("Failed to load git blob"));
 
+  /* unsafe, but okay */
+  g_atomic_int_set (&monitor->priv->found_blob, success);
+
   g_clear_object (&blob);
   g_clear_pointer (&entry_oid, ggit_oid_free);
   g_clear_pointer (&entry, ggit_tree_entry_unref);
@@ -896,5 +901,6 @@ gb_source_change_monitor_init (GbSourceChangeMonitor *monitor)
   ENTRY;
   monitor->priv = gb_source_change_monitor_get_instance_private (monitor);
   monitor->priv->cancellable = g_cancellable_new ();
+  monitor->priv->found_blob = -1;
   EXIT;
 }


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