@@ -8,17 +8,17 @@ namespace LibGit2Sharp
88 /// </summary>
99 public class Branch : IEquatable < Branch >
1010 {
11- private readonly Repository repo ;
12-
1311 private static readonly LambdaEqualityHelper < Branch > equalityHelper =
14- new LambdaEqualityHelper < Branch > ( new Func < Branch , object > [ ] { x => x . CanonicalName , x => x . Tip } ) ;
12+ new LambdaEqualityHelper < Branch > ( new Func < Branch , object > [ ] { x => x . CanonicalName , x => x . Tip } ) ;
13+
14+ private readonly Repository repo ;
1515
1616 /// <summary>
1717 /// Initializes a new instance of the <see cref = "Branch" /> class.
1818 /// </summary>
19- /// <param name= "tip">The commit which is pointed at by this Branch</param>
19+ /// <param name = "tip">The commit which is pointed at by this Branch</param>
2020 /// <param name = "repo">The repo.</param>
21- /// <param name= "canonicalName">The full name of the reference</param>
21+ /// <param name = "canonicalName">The full name of the reference</param>
2222 internal Branch ( string canonicalName , Commit tip , Repository repo )
2323 {
2424 this . repo = repo ;
@@ -34,21 +34,27 @@ internal Branch(string canonicalName, Commit tip, Repository repo)
3434 /// <summary>
3535 /// Gets the name of this branch.
3636 /// </summary>
37- public string Name { get { return ShortenName ( CanonicalName ) ; } }
37+ public string Name
38+ {
39+ get { return ShortenName ( CanonicalName ) ; }
40+ }
3841
3942 /// <summary>
40- /// Gets a value indicating whether this instance is a remote.
43+ /// Gets a value indicating whether this instance is a remote.
4144 /// </summary>
4245 /// <value>
4346 /// <c>true</c> if this instance is remote; otherwise, <c>false</c>.
4447 /// </value>
45- public bool IsRemote { get { return IsRemoteBranch ( CanonicalName ) ; } }
48+ public bool IsRemote
49+ {
50+ get { return IsRemoteBranch ( CanonicalName ) ; }
51+ }
4652
4753 /// <summary>
48- /// Gets a value indicating whether this instance is current branch (HEAD) in the repository.
54+ /// Gets a value indicating whether this instance is current branch (HEAD) in the repository.
4955 /// </summary>
5056 /// <value>
51- /// <c>true</c> if this instance is current branch; otherwise, <c>false</c>.
57+ /// <c>true</c> if this instance is current branch; otherwise, <c>false</c>.
5258 /// </value>
5359 public bool IsCurrentRepositoryHead
5460 {
@@ -68,6 +74,39 @@ public CommitCollection Commits
6874 get { return repo . Commits . StartingAt ( this ) ; }
6975 }
7076
77+ #region IEquatable<Branch> Members
78+
79+ /// <summary>
80+ /// Determines whether the specified <see cref = "Branch" /> is equal to the current <see cref = "Branch" />.
81+ /// </summary>
82+ /// <param name = "other">The <see cref = "Branch" /> to compare with the current <see cref = "Branch" />.</param>
83+ /// <returns>True if the specified <see cref = "Branch" /> is equal to the current <see cref = "Branch" />; otherwise, false.</returns>
84+ public bool Equals ( Branch other )
85+ {
86+ return equalityHelper . Equals ( this , other ) ;
87+ }
88+
89+ #endregion
90+
91+ /// <summary>
92+ /// Determines whether the specified <see cref = "Object" /> is equal to the current <see cref = "Branch" />.
93+ /// </summary>
94+ /// <param name = "obj">The <see cref = "Object" /> to compare with the current <see cref = "Branch" />.</param>
95+ /// <returns>True if the specified <see cref = "Object" /> is equal to the current <see cref = "Branch" />; otherwise, false.</returns>
96+ public override bool Equals ( object obj )
97+ {
98+ return Equals ( obj as Branch ) ;
99+ }
100+
101+ /// <summary>
102+ /// Returns the hash code for this instance.
103+ /// </summary>
104+ /// <returns>A 32-bit signed integer hash code.</returns>
105+ public override int GetHashCode ( )
106+ {
107+ return equalityHelper . GetHashCode ( this ) ;
108+ }
109+
71110 private static bool IsRemoteBranch ( string canonicalName )
72111 {
73112 return canonicalName . StartsWith ( "refs/remotes/" ) ;
@@ -89,50 +128,21 @@ private static string ShortenName(string branchName)
89128 }
90129
91130 /// <summary>
92- /// Determines whether the specified <see cref="Object"/> is equal to the current <see cref="Branch"/>.
93- /// </summary>
94- /// <param name="obj">The <see cref="Object"/> to compare with the current <see cref="Branch"/>.</param>
95- /// <returns>True if the specified <see cref="Object"/> is equal to the current <see cref="Branch"/>; otherwise, false.</returns>
96- public override bool Equals ( object obj )
97- {
98- return Equals ( obj as Branch ) ;
99- }
100-
101- /// <summary>
102- /// Determines whether the specified <see cref="Branch"/> is equal to the current <see cref="Branch"/>.
103- /// </summary>
104- /// <param name="other">The <see cref="Branch"/> to compare with the current <see cref="Branch"/>.</param>
105- /// <returns>True if the specified <see cref="Branch"/> is equal to the current <see cref="Branch"/>; otherwise, false.</returns>
106- public bool Equals ( Branch other )
107- {
108- return equalityHelper . Equals ( this , other ) ;
109- }
110-
111- /// <summary>
112- /// Returns the hash code for this instance.
113- /// </summary>
114- /// <returns>A 32-bit signed integer hash code.</returns>
115- public override int GetHashCode ( )
116- {
117- return equalityHelper . GetHashCode ( this ) ;
118- }
119-
120- /// <summary>
121- /// Tests if two <see cref="Branch"/> are equal.
131+ /// Tests if two <see cref = "Branch" /> are equal.
122132 /// </summary>
123- /// <param name= "left">First <see cref= "Branch"/> to compare.</param>
124- /// <param name= "right">Second <see cref= "Branch"/> to compare.</param>
133+ /// <param name = "left">First <see cref = "Branch" /> to compare.</param>
134+ /// <param name = "right">Second <see cref = "Branch" /> to compare.</param>
125135 /// <returns>True if the two objects are equal; false otherwise.</returns>
126136 public static bool operator == ( Branch left , Branch right )
127137 {
128138 return Equals ( left , right ) ;
129139 }
130140
131141 /// <summary>
132- /// Tests if two <see cref= "Branch"/> are different.
142+ /// Tests if two <see cref = "Branch" /> are different.
133143 /// </summary>
134- /// <param name= "left">First <see cref= "Branch"/> to compare.</param>
135- /// <param name= "right">Second <see cref= "Branch"/> to compare.</param>
144+ /// <param name = "left">First <see cref = "Branch" /> to compare.</param>
145+ /// <param name = "right">Second <see cref = "Branch" /> to compare.</param>
136146 /// <returns>True if the two objects are different; false otherwise.</returns>
137147 public static bool operator != ( Branch left , Branch right )
138148 {
0 commit comments