blob: a79825c156b63b289c49dd83249e1868463a46c1 (
plain)
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;
}
}
}
|