Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit dd9175b

Browse files
committed
Added Fetch method that accepts refspecs.
To GitClient.
1 parent 30a4d0b commit dd9175b

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/GitHub.App/Services/GitClient.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ public IObservable<Unit> Fetch(IRepository repository, string remoteName)
5151
});
5252
}
5353

54+
public IObservable<Unit> Fetch(IRepository repository, string remoteName, params string[] refspecs)
55+
{
56+
Guard.ArgumentNotEmptyString(remoteName, nameof(remoteName));
57+
58+
return Observable.Defer(() =>
59+
{
60+
var remote = repository.Network.Remotes[remoteName];
61+
repository.Network.Fetch(remote, refspecs, fetchOptions);
62+
return Observable.Return(Unit.Default);
63+
});
64+
}
65+
5466
public IObservable<Unit> SetRemote(IRepository repository, string remoteName, Uri url)
5567
{
5668
Guard.ArgumentNotEmptyString(remoteName, nameof(remoteName));

src/GitHub.Exports.Reactive/Services/IGitClient.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ public interface IGitClient
2323
/// <returns></returns>
2424
IObservable<Unit> Fetch(IRepository repository, string remoteName);
2525

26+
/// <summary>
27+
/// Fetches from the remote, using custom refspecs.
28+
/// </summary>
29+
/// <param name="repository">The repository to pull</param>
30+
/// <param name="remoteName">The name of the remote</param>
31+
/// <param name="refspecs">The custom refspecs</param>
32+
/// <returns></returns>
33+
IObservable<Unit> Fetch(IRepository repository, string remoteName, params string[] refspecs);
34+
2635
/// <summary>
2736
/// Sets the specified remote to the specified URL.
2837
/// </summary>

0 commit comments

Comments
 (0)