Skip to content

Commit db442ba

Browse files
author
Edward Thomson
committed
Merge pull request #1295 from libgit2/cmn/lazier-remote
Don't load the remote's data eagerly
2 parents 68d9be9 + 41f4dfe commit db442ba

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

LibGit2Sharp/Remote.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ internal Remote(RemoteHandle handle, Repository repository)
3131
{
3232
this.repository = repository;
3333
this.handle = handle;
34-
Name = Proxy.git_remote_name(handle);
35-
Url = Proxy.git_remote_url(handle);
36-
PushUrl = Proxy.git_remote_pushurl(handle);
37-
TagFetchMode = Proxy.git_remote_autotag(handle);
3834
refSpecs = new RefSpecCollection(this, handle);
3935
repository.RegisterForCleanup(this);
4036
}
@@ -75,27 +71,34 @@ void Dispose(bool disposing)
7571
/// <summary>
7672
/// Gets the alias of this remote repository.
7773
/// </summary>
78-
public virtual string Name { get; private set; }
74+
public virtual string Name
75+
{
76+
get { return Proxy.git_remote_name(handle); }
77+
}
7978

8079
/// <summary>
8180
/// Gets the url to use to communicate with this remote repository.
8281
/// </summary>
83-
public virtual string Url { get; private set; }
82+
public virtual string Url
83+
{
84+
get { return Proxy.git_remote_url(handle); } }
8485

8586
/// <summary>
8687
/// Gets the distinct push url for this remote repository, if set.
8788
/// Defaults to the fetch url (<see cref="Url"/>) if not set.
8889
/// </summary>
8990
public virtual string PushUrl
9091
{
91-
get { return pushUrl ?? Url; }
92-
private set { pushUrl = value; }
92+
get { return Proxy.git_remote_pushurl(handle) ?? Url; }
9393
}
9494

9595
/// <summary>
9696
/// Gets the Tag Fetch Mode of the remote - indicating how tags are fetched.
9797
/// </summary>
98-
public virtual TagFetchMode TagFetchMode { get; private set; }
98+
public virtual TagFetchMode TagFetchMode
99+
{
100+
get { return Proxy.git_remote_autotag(handle); }
101+
}
99102

100103
/// <summary>
101104
/// Gets the list of <see cref="RefSpec"/>s defined for this <see cref="Remote"/>

0 commit comments

Comments
 (0)