forked from libgit2/libgit2sharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectReference.cs
More file actions
41 lines (36 loc) · 1.2 KB
/
DirectReference.cs
File metadata and controls
41 lines (36 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using LibGit2Sharp.Core.Compat;
namespace LibGit2Sharp
{
/// <summary>
/// A DirectReference points directly to a <see cref = "GitObject" />
/// </summary>
public class DirectReference : Reference
{
private readonly Lazy<GitObject> targetBuilder;
/// <summary>
/// Needed for mocking purposes.
/// </summary>
protected DirectReference()
{ }
internal DirectReference(string canonicalName, Repository repo, ObjectId targetId)
: base(canonicalName, targetId.Sha)
{
targetBuilder = new Lazy<GitObject>(() => repo.Lookup(targetId));
}
/// <summary>
/// Gets the target of this <see cref = "DirectReference" />
/// </summary>
public virtual GitObject Target
{
get { return targetBuilder.Value; }
}
/// <summary>
/// As a <see cref = "DirectReference" /> is already peeled, invoking this will return the same <see cref = "DirectReference" />.
/// </summary>
/// <returns>This instance.</returns>
public override DirectReference ResolveToDirectReference()
{
return this;
}
}
}