From e1233d376a883b42e352d497d2de103d9aa13bcf Mon Sep 17 00:00:00 2001 From: Jamie Cansdale Date: Thu, 2 May 2019 11:21:31 +0100 Subject: [PATCH 1/2] Allow passing no refspecs to Fetch to use default Fetch(Remote remote, FetchOptions options) was removed so we need a way to use the default refspec. This is done by passing an empty array of refspecs. --- src/GitHub.App/Services/GitClient.cs | 21 ------------------- .../Services/IGitClient.cs | 10 +-------- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/src/GitHub.App/Services/GitClient.cs b/src/GitHub.App/Services/GitClient.cs index ee1bd9ea47..79dfb1df4c 100644 --- a/src/GitHub.App/Services/GitClient.cs +++ b/src/GitHub.App/Services/GitClient.cs @@ -74,27 +74,6 @@ public Task Push(IRepository repository, string branchName, string remoteName) }); } - public Task Fetch(IRepository repository, string remoteName) - { - Guard.ArgumentNotNull(repository, nameof(repository)); - Guard.ArgumentNotEmptyString(remoteName, nameof(remoteName)); - - return Task.Run(() => - { - try - { - repository.Network.Fetch(remoteName, new[] { "+refs/heads/*:refs/remotes/origin/*" }, fetchOptions); - } - catch (Exception ex) - { - log.Error(ex, "Failed to fetch"); -#if DEBUG - throw; -#endif - } - }); - } - public Task Fetch(IRepository repo, UriString cloneUrl, params string[] refspecs) { foreach (var remote in repo.Network.Remotes) diff --git a/src/GitHub.Exports.Reactive/Services/IGitClient.cs b/src/GitHub.Exports.Reactive/Services/IGitClient.cs index fccb36f260..89c0cfdab3 100644 --- a/src/GitHub.Exports.Reactive/Services/IGitClient.cs +++ b/src/GitHub.Exports.Reactive/Services/IGitClient.cs @@ -25,20 +25,12 @@ public interface IGitClient /// Task Push(IRepository repository, string branchName, string remoteName); - /// - /// Fetches the remote. - /// - /// The repository to pull - /// The name of the remote - /// - Task Fetch(IRepository repository, string remoteName); - /// /// Fetches from the remote, using custom refspecs. /// /// The repository to pull /// The name of the remote - /// The custom refspecs + /// The custom refspecs no none to use the default /// Task Fetch(IRepository repository, string remoteName, params string[] refspecs); From 66fab364aa47f9ea20715ad790f66f0149e8cbb4 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 2 May 2019 08:35:21 -0400 Subject: [PATCH 2/2] Update IGitClient.cs --- src/GitHub.Exports.Reactive/Services/IGitClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitHub.Exports.Reactive/Services/IGitClient.cs b/src/GitHub.Exports.Reactive/Services/IGitClient.cs index 89c0cfdab3..192612f9fa 100644 --- a/src/GitHub.Exports.Reactive/Services/IGitClient.cs +++ b/src/GitHub.Exports.Reactive/Services/IGitClient.cs @@ -30,7 +30,7 @@ public interface IGitClient /// /// The repository to pull /// The name of the remote - /// The custom refspecs no none to use the default + /// The custom refspecs or none to use the default /// Task Fetch(IRepository repository, string remoteName, params string[] refspecs);