Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 65094de

Browse files
Returning a completed task
1 parent 411a536 commit 65094de

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

src/GitHub.Api/Git/Repository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public ITask SetupRemote(string remote, string remoteUrl)
8282
public ITask<List<GitLogEntry>> Log()
8383
{
8484
if (repositoryManager == null)
85-
return new FuncListTask<GitLogEntry>(CancellationToken.None,_ => new List<GitLogEntry>());
85+
return new FuncListTask<GitLogEntry>(TaskHelpers.GetCompletedTask(new List<GitLogEntry>()));
8686

8787
return repositoryManager.Log();
8888
}

src/GitHub.Api/GitHub.Api.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
<Compile Include="Helpers\Constants.cs" />
110110
<Compile Include="Cache\IBranchCache.cs" />
111111
<Compile Include="Helpers\Validation.cs" />
112+
<Compile Include="Helpers\TaskHelpers.cs" />
112113
<Compile Include="Platform\DefaultEnvironment.cs" />
113114
<Compile Include="Extensions\EnvironmentExtensions.cs" />
114115
<Compile Include="Extensions\FileEventExtensions.cs" />

src/GitHub.Api/Helpers/TaskHelpers.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System.Threading.Tasks;
2+
3+
namespace GitHub.Unity
4+
{
5+
static class TaskHelpers
6+
{
7+
public static Task<T> GetCompletedTask<T>(T result)
8+
{
9+
return TaskEx.FromResult(result);
10+
}
11+
}
12+
}

0 commit comments

Comments
 (0)