[gitg] Override storing ref specs on custom GitgRemote
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Override storing ref specs on custom GitgRemote
- Date: Thu, 30 Jul 2015 18:38:55 +0000 (UTC)
commit 4faa86f163f23c0b7bacc2a60cb34e6ec2b1cbc2
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Thu Jul 30 20:38:14 2015 +0200
Override storing ref specs on custom GitgRemote
gitg/gitg-remote-manager.vala | 25 +++++--------------------
libgitg/gitg-remote.vala | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 20 deletions(-)
---
diff --git a/gitg/gitg-remote-manager.vala b/gitg/gitg-remote-manager.vala
index 0132503..d008855 100644
--- a/gitg/gitg-remote-manager.vala
+++ b/gitg/gitg-remote-manager.vala
@@ -134,22 +134,14 @@ class RemoteManager : Object, GitgExt.RemoteLookup
string[] fetch_specs;
string[] push_specs;
- try
- {
- fetch_specs = remote.get_fetch_specs();
- } catch { break; }
-
- try
- {
- push_specs = remote.get_push_specs();
- } catch { break; }
+ fetch_specs = remote.fetch_specs;
+ push_specs = remote.push_specs;
- var defspec = "+refs/heads/*:refs/remotes/" + name + "/*";
Gitg.Remote? tmp = null;
try
{
- tmp = (new Ggit.Remote.anonymous(d_window.repository, url, defspec))
as Gitg.Remote;
+ tmp = (new Ggit.Remote.anonymous(d_window.repository, url)) as
Gitg.Remote;
}
catch (Error e)
{
@@ -161,15 +153,8 @@ class RemoteManager : Object, GitgExt.RemoteLookup
break;
}
- try
- {
- tmp.set_fetch_specs(fetch_specs);
- } catch { break; }
-
- try
- {
- tmp.set_push_specs(push_specs);
- } catch { break; }
+ tmp.fetch_specs = fetch_specs;
+ tmp.push_specs = push_specs;
remote = tmp;
break;
diff --git a/libgitg/gitg-remote.vala b/libgitg/gitg-remote.vala
index d9b59d5..715c658 100644
--- a/libgitg/gitg-remote.vala
+++ b/libgitg/gitg-remote.vala
@@ -40,6 +40,8 @@ public class Remote : Ggit.Remote
{
private RemoteState d_state;
private Error? d_authentication_error;
+ private string[]? d_fetch_specs;
+ private string[]? d_push_specs;
public Error authentication_error
{
@@ -202,6 +204,41 @@ public class Remote : Ggit.Remote
public new async void fetch(Ggit.Signature signature, string? message) throws Error
{
yield download_intern(signature, message);
+
+ public string[]? fetch_specs {
+ owned get {
+ if (d_fetch_specs != null) {
+ return d_fetch_specs;
+ }
+
+ try {
+ return get_fetch_specs();
+ } catch (Error e) {
+ return null;
+ }
+ }
+
+ set {
+ d_fetch_specs = value;
+ }
+ }
+
+ public string[]? push_specs {
+ owned get {
+ if (d_push_specs != null) {
+ return d_push_specs;
+ }
+
+ try {
+ return get_push_specs();
+ } catch (Error e) {
+ return null;
+ }
+ }
+
+ set {
+ d_push_specs = value;
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]