Skip to content

Commit 1e5e637

Browse files
committed
Remote: expose the underlying Indexer's stats
1 parent 3af9283 commit 1e5e637

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

LibGit2Sharp/Remote.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class Remote : IEquatable<Remote>
1818
public List<PktRef> Refs { get; private set; }
1919
private Lazy<IEnumerable<string>> refnames;
2020
private Lazy<IEnumerable<string>> matching_refs;
21+
private Indexer indexer;
2122

2223
/* Mostly so that the already-existing code doesn't break */
2324
public Remote()
@@ -74,12 +75,22 @@ public void Connect()
7475
}
7576
}
7677

78+
public IndexerStats Stats
79+
{
80+
get {
81+
return indexer.Stats;
82+
}
83+
}
84+
7785
public void Download(string path)
7886
{
7987
Ensure.ArgumentNotNullOrEmptyString(path, "path");
8088
if (!Directory.Exists(path))
8189
Directory.CreateDirectory(path);
8290

91+
var indexer = new Indexer(path);
92+
this.indexer = indexer;
93+
8394
/* First, let's see what we want. At this point we don't send any haves */
8495
Stream stream = new MemoryStream();
8596
var writer = new StreamWriter(stream);
@@ -107,7 +118,6 @@ public void Download(string path)
107118
if (!(pkt is PktAck || pkt is PktNak))
108119
throw new GitProtocolException("Expected ACK or NAK, got neither");
109120

110-
var indexer = new Indexer(path);
111121
indexer.IndexStream(stream);
112122
}
113123

0 commit comments

Comments
 (0)