Skip to content

Commit d49aad7

Browse files
yorahdahlbyk
authored andcommitted
Add SubmoduleLazyGroup
1 parent 83fb045 commit d49aad7

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using LibGit2Sharp.Core.Handles;
3+
4+
namespace LibGit2Sharp.Core
5+
{
6+
internal class SubmoduleLazyGroup : LazyGroup<SubmoduleSafeHandle>
7+
{
8+
private readonly string name;
9+
10+
public SubmoduleLazyGroup(Repository repo, string name)
11+
: base(repo)
12+
{
13+
this.name = name;
14+
}
15+
16+
protected override void EvaluateInternal(Action<SubmoduleSafeHandle> evaluator)
17+
{
18+
using (var handle = Proxy.git_submodule_lookup(repo.Handle, name))
19+
{
20+
evaluator(handle);
21+
}
22+
}
23+
}
24+
}

LibGit2Sharp/LibGit2Sharp.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
<Compile Include="Core\Handles\GitFetchSpecHandle.cs" />
7373
<Compile Include="Core\PathCase.cs" />
7474
<Compile Include="Core\Handles\SubmoduleSafeHandle.cs" />
75+
<Compile Include="Core\SubmoduleLazyGroup.cs" />
7576
<Compile Include="Network.cs" />
7677
<Compile Include="Core\GitRemoteHead.cs" />
7778
<Compile Include="Stash.cs" />

0 commit comments

Comments
 (0)