From 41f4dfe1ca8437be607c13934a1e71e760e693af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Fri, 1 Apr 2016 14:20:49 +0200 Subject: [PATCH] Don't load the remote's data eagerly Instead only bring these strings into a managed context if the caller asks for them. --- LibGit2Sharp/Remote.cs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/LibGit2Sharp/Remote.cs b/LibGit2Sharp/Remote.cs index 95bccb714..08347379f 100644 --- a/LibGit2Sharp/Remote.cs +++ b/LibGit2Sharp/Remote.cs @@ -31,10 +31,6 @@ internal Remote(RemoteHandle handle, Repository repository) { this.repository = repository; this.handle = handle; - Name = Proxy.git_remote_name(handle); - Url = Proxy.git_remote_url(handle); - PushUrl = Proxy.git_remote_pushurl(handle); - TagFetchMode = Proxy.git_remote_autotag(handle); refSpecs = new RefSpecCollection(this, handle); repository.RegisterForCleanup(this); } @@ -75,12 +71,17 @@ void Dispose(bool disposing) /// /// Gets the alias of this remote repository. /// - public virtual string Name { get; private set; } + public virtual string Name + { + get { return Proxy.git_remote_name(handle); } + } /// /// Gets the url to use to communicate with this remote repository. /// - public virtual string Url { get; private set; } + public virtual string Url + { + get { return Proxy.git_remote_url(handle); } } /// /// Gets the distinct push url for this remote repository, if set. @@ -88,14 +89,16 @@ void Dispose(bool disposing) /// public virtual string PushUrl { - get { return pushUrl ?? Url; } - private set { pushUrl = value; } + get { return Proxy.git_remote_pushurl(handle) ?? Url; } } /// /// Gets the Tag Fetch Mode of the remote - indicating how tags are fetched. /// - public virtual TagFetchMode TagFetchMode { get; private set; } + public virtual TagFetchMode TagFetchMode + { + get { return Proxy.git_remote_autotag(handle); } + } /// /// Gets the list of s defined for this