[gnome-builder] git: clip body to most recent message line



commit 019548495143a0742c8f67bbe7b9f72b4509ec67
Author: Christian Hergert <chergert redhat com>
Date:   Mon Feb 11 16:46:19 2019 -0800

    git: clip body to most recent message line

 src/plugins/git/gbp-git-remote-callbacks.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/git/gbp-git-remote-callbacks.c b/src/plugins/git/gbp-git-remote-callbacks.c
index d9d8feba3..047b9010c 100644
--- a/src/plugins/git/gbp-git-remote-callbacks.c
+++ b/src/plugins/git/gbp-git-remote-callbacks.c
@@ -87,7 +87,28 @@ gbp_git_remote_callbacks_real_progress (GgitRemoteCallbacks *callbacks,
   else
     g_string_append (self->body, message);
 
-  ide_notification_set_body (self->progress, self->body->str);
+  if (self->body->len > 1)
+    {
+      const gchar *endptr;
+
+      endptr = &self->body->str[self->body->len - 1];
+
+      if (*endptr == '\n')
+        endptr--;
+
+      while (endptr >= self->body->str)
+        {
+          if (*endptr == '\n' || *endptr == '\r')
+            {
+              message = endptr + 1;
+              break;
+            }
+
+          endptr--;
+        }
+    }
+
+  ide_notification_set_body (self->progress, message);
 }
 
 static void


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