From 90e9ea966661333e35db524485fa5b5e5f517376 Mon Sep 17 00:00:00 2001 From: Alberto Fanjul Date: Mon, 6 May 2019 09:36:45 +0200 Subject: [PATCH] Polish push action - Avoid to connect to repo, that is managed by push operation - Add access to ssh socket for flatpak - Reload repo after push to reflect changes --- gitg/gitg-ref-action-push.vala | 1 + libgitg/gitg-remote.vala | 14 ++++---------- org.gnome.gitgDevel.json | 1 + 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/gitg/gitg-ref-action-push.vala b/gitg/gitg-ref-action-push.vala index 9ff91417..752877a4 100644 --- a/gitg/gitg-ref-action-push.vala +++ b/gitg/gitg-ref-action-push.vala @@ -109,6 +109,7 @@ class RefActionPush : GitgExt.UIElement, GitgExt.Action, GitgExt.RefAction, Obje try { yield d_remote.push(branch, null); + ((Gtk.ApplicationWindow)application).activate_action("reload", null); } catch (Error e) { diff --git a/libgitg/gitg-remote.vala b/libgitg/gitg-remote.vala index e016f3c7..9c763f13 100644 --- a/libgitg/gitg-remote.vala +++ b/libgitg/gitg-remote.vala @@ -311,14 +311,6 @@ public class Remote : Ggit.Remote private async void push_intern(string branch, Ggit.RemoteCallbacks? callbacks) throws Error { - bool dis = false; - - if (!get_connected()) - { - dis = true; - yield connect(Ggit.Direction.PUSH, callbacks); - } - state = RemoteState.TRANSFERRING; reset_transfer_progress(false); @@ -326,6 +318,10 @@ public class Remote : Ggit.Remote { yield Async.thread(() => { var options = new Ggit.PushOptions(); + if (d_callbacks == null) { + d_callbacks = new Callbacks(this, callbacks, update_transfer_progress); + } + options.set_remote_callbacks(d_callbacks); string [] push_refs = { "refs/heads/%s:refs/heads/%s".printf(branch, branch) }; @@ -336,12 +332,10 @@ public class Remote : Ggit.Remote } catch (Error e) { - update_state(dis); reset_transfer_progress(true); throw e; } - update_state(dis); reset_transfer_progress(true); } diff --git a/org.gnome.gitgDevel.json b/org.gnome.gitgDevel.json index 45f16c51..4349a709 100644 --- a/org.gnome.gitgDevel.json +++ b/org.gnome.gitgDevel.json @@ -14,6 +14,7 @@ "--share=network", "--socket=x11", "--socket=wayland", + "--socket=ssh-auth", "--filesystem=host", "--filesystem=xdg-run/dconf", "--filesystem=~/.config/dconf:ro",