From c14ac81638f9b79a220d76266b123b6bfe42de21 Mon Sep 17 00:00:00 2001 From: Corentin Damman Date: Mon, 14 Apr 2025 15:49:05 +0200 Subject: [PATCH] feature: Display notification with remote message during push Relates to #1170 --- src/Commands/Push.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/Commands/Push.cs b/src/Commands/Push.cs index dc81f606..70d0e527 100644 --- a/src/Commands/Push.cs +++ b/src/Commands/Push.cs @@ -1,4 +1,7 @@ using System; +using System.Collections.Generic; + +using Avalonia.Threading; namespace SourceGit.Commands { @@ -39,11 +42,29 @@ namespace SourceGit.Commands Args += $"{remote} {refname}"; } + public new bool Exec() + { + if (!base.Exec()) + { + return false; + } + if (_remoteMessage.Count > 0) + { + Dispatcher.UIThread.Post(() => App.SendNotification(Context, string.Join("\n", _remoteMessage))); + } + return true; + } + protected override void OnReadline(string line) { + if (line.StartsWith("remote: ")) + { + _remoteMessage.Add(line.Substring(8)); + } _outputHandler?.Invoke(line); } private readonly Action _outputHandler = null; + private List _remoteMessage = new List(); } }