Skip to content

Commit 95bc3af

Browse files
committed
Expose the underlying reference for ReferenceWrapper
This lets us get to the reference's information without having to ask the wrapper object for the information.
1 parent 3615df9 commit 95bc3af

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

LibGit2Sharp/Branch.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ public virtual bool IsCurrentRepositoryHead
110110
{
111111
if (this is DetachedHead)
112112
{
113-
return repo.Head.reference.TargetIdentifier == this.reference.TargetIdentifier;
113+
return repo.Head.Reference.TargetIdentifier == this.Reference.TargetIdentifier;
114114
}
115115

116-
return repo.Head.reference.TargetIdentifier == this.CanonicalName;
116+
return repo.Head.Reference.TargetIdentifier == this.CanonicalName;
117117
}
118118
}
119119

LibGit2Sharp/ReferenceWrapper.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public abstract class ReferenceWrapper<TObject> : IEquatable<ReferenceWrapper<TO
1616
/// The repository.
1717
/// </summary>
1818
protected readonly Repository repo;
19-
protected readonly Reference reference;
19+
private readonly Reference reference;
2020
private readonly Lazy<TObject> objectBuilder;
2121

2222
private static readonly LambdaEqualityHelper<ReferenceWrapper<TObject>> equalityHelper =
@@ -61,6 +61,17 @@ public virtual string FriendlyName
6161
get { return Shorten(); }
6262
}
6363

64+
/// <summary>
65+
/// The underlying <see cref="Reference"/>
66+
/// </summary>
67+
public virtual Reference Reference
68+
{
69+
get
70+
{
71+
return reference;
72+
}
73+
}
74+
6475
/// <summary>
6576
/// Returns the <see cref="CanonicalName"/>, a <see cref="string"/> representation of the current reference.
6677
/// </summary>

0 commit comments

Comments
 (0)